【问题标题】:Installing Packages on ATOM for python (linter and autopep8)在 ATOM 上为 python 安装包(linter 和 autopep8)
【发布时间】:2021-09-29 19:29:37
【问题描述】:

我正在尝试为 Python 的 ATOM 设置我的环境。我在以前的 PC 上做过这个,并没有遇到太大的麻烦,但这次我相信有些事情搞砸了,我不知道如何修复它。

Linter-flake8 安装:

我是这样安装的:

settings --> install --> search packages --> linter-flake8 --> install. 

之后会自动安装依赖项。

然后我运行 CMD 并使用以下命令安装 flake8:

py -m pip install flake8

当我尝试在 ATOM 中输入我的代码时;我收到此错误:

[Linter] Error running Flake8 Error: Failed to spawn command `flake8`. Make sure `flake8` is installed and on your PATH
at C:\Users\yazan\.atom…\lib\helpers.js:130
(anonymous) @   C:\Users\yazan\.atom…ter\dist\index.js:1

我尝试解决的问题:

  1. 将 ATOM 添加到我的路径中,我做了但没有奏效(ATOM 和 Python 都在我的用户和系统、环境变量中)
  2. 检查我的 ATOM 是否运行相同版本的 python。
import sys
print(sys.version)
3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
  1. 在 CMD 中检查了我的 linter-flake8 的安装路径:

结果 -->

C:\Users\yazan>py -m pip install flake8
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: flake8 in c:\users\yazan\appdata\roaming\python\python39\site-packages (3.9.2)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in 
c:\users\yazan\appdata\roaming\python\python39\site-packages (from flake8) (0.6.1)
Requirement already satisfied: pyflakes<2.4.0,>=2.3.0 in 
c:\users\yazan\appdata\roaming\python\python39\site-packages (from flake8) (2.3.1)
Requirement already satisfied: pycodestyle<2.8.0,>=2.7.0 in 
c:\users\yazan\appdata\roaming\python\python39\site-packages (from flake8) (2.7.0)

我的想法用完了,搜索了很多,但不知道如何解决这个问题。

谢谢!

【问题讨论】:

    标签: python pip atom-editor flake8 linter


    【解决方案1】:

    如 linter-flake8 README 中所述,您可以在包设置中设置 executablePath。这应该可以帮助您绕过 Atom 对环境变量的不稳定支持。

    【讨论】:

    • 感谢您的回复,那我就直接进入环境变量里面加上上面的路径吧?
    • 不,反之亦然:将flake8 的完整路径添加到此设置(例如which flake8 的结果)
    • 我明白了!非常感谢!
    猜你喜欢
    • 2014-09-03
    • 1970-01-01
    • 2018-12-15
    • 2015-07-01
    • 1970-01-01
    • 2021-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多