Linter pylint is not installed

前端 未结 15 1772
遥遥无期
遥遥无期 2020-12-12 12:56

I want to run python code in Microsoft Visual Studio Code but it gives an error:

\"Linter pylint is not installed\"

I installed:

相关标签:
15条回答
  • 2020-12-12 13:11

    Check the path pylint has been installed to, by typing which pylint on your terminal.

    You will get something like: /usr/local/bin/pylint

    Copy it.

    Go to your vscode settings on the preferences tab and find the line that goes

    "python.linting.pylintPath": "pylint"

    Edit the line to be

    "python.linting.pylintPath": "/usr/local/bin/pylint",

    replacing the value "pylint" with the path you got from typing which pylint

    Save your changes and reload vscode.

    0 讨论(0)
  • 2020-12-12 13:14
    1. Open a terminal (ctrl+~)
    2. Run the command pip install pylint

    If that doesn't work: On the off chance you've configured a non-default python path for your editor, you'll need to match that python's install location with the pip executable you're calling from the terminal.

    This is an issue because the Python extension's settings enable pylint by default. If you'd rather turn off linting, you can instead change this setting from true to false in your user or workspace settings:

    "python.linting.pylintEnabled": false
    
    0 讨论(0)
  • 2020-12-12 13:14

    If you're working in a virtual environment (virtualenv), you'll definitely need to update the python.lintint.pylintPath setting (and probably the python.pythonPath setting, as well, if you haven't already) if you want linting to work, like this:

    // settings.json (workspace-specific one is probably best)
    {
        // ...
        "python.linting.pylintPath": "C:/myproject/venv/Scripts/pylint.exe",
        "python.pythonPath": "C:/myproject/venv/Scripts/python.exe",
        // ...
    }
    

    That's for Windows, but other OSs are similar. The .exe extension was necessary for it to work for me on Windows, even though it's not required when actually running it in the console.

    If you just want to disable it, then use the python.linting.pylintEnabled": false setting as mentioned in Ben Delaney's answer.

    0 讨论(0)
  • 2020-12-12 13:17

    I also had this problem. If you also have Visual Studio installed with the Python extension, the system will want to use Studio's version of Python. Set the Environment Path to the version in Studio's Shared folder. For me, that was:

    C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\
    

    After that, run

    python -m pip install pylint
    

    from a command prompt with Administrator rights.

    0 讨论(0)
  • 2020-12-12 13:18

    A similar issue happened to me after I a completely reinstalled Python. Opening the settings.json by Ctrl+ ⇧ Shift+P:

                                 
    

    and I saw that I had set the default linter to

    "python.linting.pylintPath": "pylint_django"
    

    so opening a terminal (e.g., Ctrl + ⇧Shift + ~) and the installing

    pip install pylint_django
    

    solved the problem.

    0 讨论(0)
  • 2020-12-12 13:19

    If your using pipenv then you just have to

    pipenv install pylint
    

    to install pylint to your virtual environment

    pipenv shell
    

    to activate the environment and thus make pylintavailable. Then start code in that enviroment

    code .
    

    Boom! your good to code ;-)

    0 讨论(0)
提交回复
热议问题