简体   繁体   中英

How to make Python linting work in VSCode

I assumed that installing the python extension would automatically support linting. For Javascript I get the error squiggles, but no luck with Python.

I think it is supposed to work out of the box, but it didn't. These are the settings for the workspace:

{
    "python.pythonPath": "/Users/mark/.pyenv/versions/ve381/bin/python",
    "python.linting.pylintEnabled": true,
    "python.linting.enabled": true
} 

Any idea how to solve this?

Even though it's enabled by default, there's the extra step that you have to select the linter (and probably install it if you haven't already).

If you click on the gear at the bottom left, and select Command Palette, then in the text box that appears at the top of the window, type "linter" and "Python: Select Linter" should come up.

A default linter is pylint. If you select it and it's not installed, you will be prompted to install it. When I did so, I ran into problems on my Windows OS with SSL certificates or something like that (I would get the same error if trying to install from CMD prompt). So I went to the anaconda prompt I was using and installed it there in my conda environment and that worked.

But if it works for you to install from inside Code, then you're done.

pylint 不工作的原因是一个 .pylintrc 文件,它需要一个没有安装的库。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM