Python VS代码不';我不认识pep8
为了在Python中使用linting,我将Python VS代码不';我不认识pep8,python,visual-studio-code,Python,Visual Studio Code,为了在Python中使用linting,我将VS-code配置为: "python.linting.enabled": true, "python.linting.pylintEnabled": false, "python.linting.pep8Enabled": true, "python.linting.lintOnTextChange": true, "python.linting.lintOnSave": true 然后我打开了一个*.py文件,添加了一个不必要的空间并保存了下来,
VS-code
配置为:
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.pep8Enabled": true,
"python.linting.lintOnTextChange": true,
"python.linting.lintOnSave": true
然后我打开了一个*.py
文件,添加了一个不必要的空间并保存了下来,然后我得到了一个错误:Linter pep8未安装
但是我已经安装了pep8
。通过使用VS代码控制台,我可以找到pep8
使用VS代码控制台
也许我是通过使用brew
安装的pip2
安装了pep8
带操作系统控制台(iTerm2)
我做错了什么
插件
听起来可能微不足道,但您是否已为vscode安装了
Python
?DonJayamanne的作品很棒
如果是这样,请尝试将您的代码添加到vscode编辑器的设置中,至少它解决了我的问题
pep8
路径应该自动查找,如果没有,您可能还需要添加路径。我知道这是一个老问题,但我遇到了与VS code无法识别pep8相同的问题。卸载后重新安装对我起了作用。PEP8被重命名为。在Python VS代码扩展(由Microsoft提供)中,它已在命令选项板和settings.json文件中重命名。但是,它们的文档还不是最新的,它们可能会令人困惑。pep8的问题是因为vscode现在使用的是flake8,基本上是相同的,pep8重命名为pycodestyle,flake8使用pycodestyle,这是旧配置:
"python.linting.pep8Enabled": true, // Don't use it
但是现在在vscode中找不到该配置,新的配置行现在是:
"python.linting.flake8Enabled": true, // This is the new config for pep8
如果第二个选项不起作用,您可以尝试以下操作:
"python.linting.pycodestyleEnabled": true // You need: pip install pycodestyle
我希望这个答案对您有所帮助尝试安装Python for VSCode和pip安装flake 8
。我已经安装了Python for VSCode
。我安装了flake8
,但我得到了相同的错误。我将在我的问题中添加插件信息。在mac上,在我添加了:“python.linting.pycodestyleEnabled”:true
到~/Library/Application Support/code/User/settings.json之后,pep8检查对我有效
"python.linting.pep8Enabled": true, // Don't use it
"python.linting.flake8Enabled": true, // This is the new config for pep8
"python.linting.pycodestyleEnabled": true // You need: pip install pycodestyle