Fix for Linting Not Working on VS Code

Once you install the Python plugin, you might observe that linting does not work. Consider the file below where I’ve written gibberish, but no errors are shown:

1. Install PyLint

The problem is that you probably don’t have PyLint installed in your virtual environment. Open a new terminal by typing Ctrl + Shift + ~ (the character right below Esc).

VS Code should automatically switch to your virtual environment. Type pip install pylint.

2. Select PyLint as the Linter

Press Ctrl + Shift + P and type “select linter.” Select the first option:

Once you select the first option, it will prompt you with a list of linters. Select PyLint which will typically be at the end of the list.

3. Save Your File

Linting typically occurs when you save your file. Go back to the file you were editing and press Ctrl + S (save it anyway even if you haven’t made any changes). Linting should start showing up:

4. Conclusion

You need to do this for every new virtual environment that you create if they don’t have PyLint installed already.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Site Footer

Sliding Sidebar