问题
I'm trying to make PyLint automagically use correct conda environment inside vscode
but still getting import errors: [pylint] E0401:Unable to import 'django'
, although:
- I'm starting
vscode
from correct environment. [1] - I have installed Python extension. [2]
- I have set correct
python.path
. [3]
回答1:
You have to have installed pylint
in this conda environment.
Activate given environment with
activate env_name
(Windows) orsource activate env_name
.Install pylint in this environment:
conda install pylint # or 'pip install pylint'
Finally restart vscode.
Source: https://github.com/DonJayamanne/pythonVSCode/wiki/Troubleshooting-Linting
回答2:
Even after correct installation of python and pylint faced the issue due to wrong configuration of pylintArgs in visual studio code.
With below user settings got the issue resolved
"python.linting.pylintArgs": [
"--load-plugins",
"pylint_django"
]
来源:https://stackoverflow.com/questions/45092182/start-pylint-from-correct-anaconda-environment-in-visual-studio-code