Start PyLint from correct anaconda environment in Visual Studio Code

白昼怎懂夜的黑 提交于 2020-04-13 06:36:53

问题


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.

  1. Activate given environment with activate env_name (Windows) or source activate env_name.

  2. Install pylint in this environment:

    conda install pylint # or 'pip install pylint'
    
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!