如何使用 PyCharm 运行 Pylint [英] How to run Pylint with PyCharm
问题描述
我想在我正在处理的 Python 项目的整个项目目录中将 Pylint 配置为外部工具.我尝试将存储库用作带有 __init__.py
和不带的模块,但无论如何它都不起作用.
我在设置 Pylint 以与 PyCharm 一起运行时遇到困难.我知道我应该将它作为外部工具运行,但是设置让我感到困惑.
他们文档中的权威来源已损坏,因此我也无法检查.
您可以按照以下步骤设置 Pylint 与 PyCharm 一起使用:
安装
pylint
:$ pip install pylint
找到您的
pylint
安装文件夹:$ which pylint # MacOS/Linux/usr/local/bin/pylint # 这只是一个可能的输出 - 检查你的<!-->$ where pylint # Windows%LocalAppData%\Programs\Python\Python36-32\Scripts\pylint.exe # 可能的位置
使用菜单文件→设置打开PyCharm设置窗口,然后导航到菜单工具→外部工具 在侧边栏中.(或搜索外部工具")
通过单击
+
符号并相应地填写字段来设置外部工具.在 Program 中使用运行which pylint
时获得的路径.对于其他值,您可以使用图像中的相同值.从菜单工具运行
pylint
→ 外部工具 → pylint:在 PyCharm 终端中查看您的输出
有关更多详细信息,请参阅
I want to configure Pylint as an external tool in my entire project directory for a Python project that I'm working on. I've tried to use the repository as a module with __init__.py
and without, and it's not working either way.
I'm having difficulty setting up Pylint to run with PyCharm. I know that I should be running it as an external tool, however the settings confuse me.
The authoritative source on their documentation is broken, so I can't check that up either.
You can set up Pylint to work with PyCharm by following the following steps:
Install
pylint
:$ pip install pylint
Locate your
pylint
installation folder:$ which pylint # MacOS/Linux /usr/local/bin/pylint # This is just a possible output - check yours <!--> $ where pylint # Windows %LocalAppData%\Programs\Python\Python36-32\Scripts\pylint.exe # Possible location
Open the PyCharm settings window with menu File → Settings, then navigate to menu Tools → External Tools in the sidebar. (Or search "external tools")
Set up an external tool by clicking on the
+
sign and filling in the fields accordingly. In Program use the path you got when runningwhich pylint
. For the other values, you can use the same from the image.Run
pylint
from menu Tools → External Tools → pylint:Look at your output in the PyCharm terminal
For more details, refer to Pylinting with PyCharm.
If you want to use Pylint to check your whole project or a particular file or directory, you can right click on your project root, file or directory, then activate External Tools → pylint as shown below.
这篇关于如何使用 PyCharm 运行 Pylint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!