繁体   English   中英

在 ATOM 上为 python 安装包(linter 和 autopep8)

[英]Installing Packages on ATOM for python (linter and autopep8)

我正在尝试为 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)

我的想法用完了,搜索了很多但无法弄清楚如何解决这个问题。

谢谢!

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

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM