Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python VS代码不';我不认识pep8_Python_Visual Studio Code - Fatal编程技术网

Python VS代码不';我不认识pep8

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文件,添加了一个不必要的空间并保存了下来,

为了在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
文件,添加了一个不必要的空间并保存了下来,然后我得到了一个错误:
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