Search code examples
pythonvisual-studio-codeanacondacondapylint

Start PyLint from correct anaconda environment in Visual Studio Code


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]

Solution

  • You have to install 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