I want to run python code in Microsoft Visual Studio Code but it gives an error:
\"Linter pylint is not installed\"
I installed:
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.
ctrl+~
)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
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.
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.
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.
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 pylint
available. Then start code
in that enviroment
code .
Boom! your good to code ;-)