English 中文(简体)
pylint no member issue butcode still work vscode
原标题:pylint no member issue but code still works vscode

我在此有非常简单的法典。

import torch

l = torch.nn.Linear(2,5)
v = torch.FloatTensor([1, 2])
print(l(v))

torch.FloatTensor, pylint in视觉演化室代码声称,模块火力没有FloatTensor成员 p(无成员)。

但是,该法典有价值。 这是一种虚假的正面吗? 我如何为这一具体事例提供可分的提纲?

最佳回答
  1. Press: CTRL + Shift+

  2. 关于“优惠:开放环境”的浮标

  3. Add this line into JSON : "python.linting.pylintArgs": ["--generated-members", "from_json,query"]


问题回答

对我来说,什么是用什么模块来说明这些错误,即:<代码>torch,然后遵循这些步骤:

  1. hit CTRL + Shift + P
  2. click on "Preferences: Open Settings (JSON)"
  3. add the following to the JSON file you are presented with:
"python.linting.pylintArgs": [
    "--generated-members", "torch.*"
]

为了这一回答,你说,还有其他一些模块存在问题,因此,你写道:

"python.linting.pylintArgs": [
    "--generated-members", "torch.* other_module.* next_module.*"
]

是的,它是一个Pylint的问题。

If you use Anaconda, you can do:
1. search python.linting.pylintPath in your VSCode setting
2. change it to (You Anaconda Path)pkgspylint-1.8.4-py36_0Scriptspylint

Younaconda Path and pylint-1.8.4-py36_0 may各异

www.un.org/Depts/DGACM/index_spanish.htm 页: 1

"pylint.args": [
    ""--generated-members", "torch.*""
  ]

Tomari说,它确实在窗户上工作。 气温差别不大。 途径可能如“(You Anaconda Path)/pkgs/pylint-2.6.0-py38_0/bin/pylint”。

接受的答复似乎已经过时。 VS 法典不承认关键“python.linting.pylintArgs”。 而是使用“pylint.args”。

"pylint.args": ["--generated-members", "torch.*"]




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签