VS Code 无法识别 pep8 [英] VS Code doesn't recognize pep8

查看:83
本文介绍了VS Code 无法识别 pep8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了对 Python 使用 linting,我这样配置 VS Code:

To use linting for Python, I configured VS Code like this:

"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.pep8Enabled": true,
"python.linting.lintOnTextChange": true,
"python.linting.lintOnSave": true

然后我打开一个*.py文件并添加了一个不必要的空间并保存,然后我得到一个错误:Linter pep8 is not installed.

Then I opened a *.py file and added an unnecessary space and saved, then I got an error: Linter pep8 is not installed.

但我已经安装了pep8.通过使用 VS Code 控制台,我可以找到 pep8.

But I already installed pep8. And by using VS Code console I can find the pep8.

/usr/bin/python -m pip install pep8
loading ~/.zshrc_osx
ironsand@macbook ~ % /usr/bin/python -m pip install pep8
/usr/bin/python: No module named pip
ironsand@macbook ~ % which python
/usr/bin/python
ironsand@macbook ~ % which pep8
/usr/local/bin/pep8
ironsand@macbook ~ % pep8 --version
1.7.0
ironsand@macbook ~ % which python
/usr/bin/python
ironsand@macbook ~ %

也许我使用安装了 brewpip2 安装了 pep8.

Maybe I installed pep8 by using pip2 that is installed brew.

python --version
Python 2.7.10
ironsand@macbook ~ % /usr/local/bin/pip2 install pep8
Collecting pep8
  Using cached pep8-1.7.0-py2.py3-none-any.whl
Installing collected packages: pep8
Successfully installed pep8-1.7.0

我做错了什么?

MagicPython 1.0.12
Python 0.7.0
Python for VSCode 0.2.3

推荐答案

PEP8 更名为 pycodestyle.在 Python VS Code 扩展(由 Microsoft)中,它已在命令面板和 settings.json 文件中重命名.然而,它们的文档还不是最新的,它们可能会令人困惑.

PEP8 was renamed to pycodestyle. In the Python VS Code Extension (by Microsoft) it is already renamed in the command palette and in the settings.json file. However the documentation for them are not up-to-date yet and they can be confusing.

这篇关于VS Code 无法识别 pep8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆