gpt4 book ai didi

flake8 - 打开 python 文件时出现 Flymake 配置错误,但正确设置 flake

转载 作者:行者123 更新时间:2023-12-01 19:11:05 25 4
gpt4 key购买 nike

当我在 emacs 中打开 python 文件时,收到以下错误消息:

Flymake: Configuration error has occured while running (flake8 >..../xyz_flymake.py). Flymake will be switched OFF.

但另一方面,我似乎已经配置了 elpy 正常工作所需的所有模块:

Elpy Configuration

Virtualenv........: None
RPC Python........: 3.5.3 (/usr/bin/python3.5)
Interactive Python: /usr/bin/python3.5 (/usr/bin/python3.5)
Emacs.............: 24.5.1
Elpy..............: 1.10.0
Jedi..............: 0.10.2
Rope..............: 0.10.5
Importmagic.......: 0.1.7
Autopep8..........: 0.1.7
Syntax checker....: flake8 (/usr/local/bin/flake8)

You have not activated a virtual env. While Elpy supports this, it is
often a good idea to work inside a virtual env. You can use M-x
pyvenv-activate or M-x pyvenv-workon to activate a virtual env.

The directory ~/.local/bin/ is not in your PATH. As there is no active
virtualenv, installing Python packages locally will place executables
in that directory, so Emacs won't find them. If you are missing some
commands, do add this directory to your PATH.

Options

`Raised' text indicates buttons; type RET or click mouse-1 on a button
to invoke its action. Invoke [+] to expand a group, and [-] to
collapse an expanded group. Invoke the [Group], [Face], and [Option]
buttons below to edit that item in another window.

如何解决这个问题?

最佳答案

目前尚不清楚配置错误是什么。您可能遇到了众多问题之一。

  1. 您似乎想使用 Python 3.5,但没有明确指示正在运行的 Python Flake8 版本。可能是 elpy 检测到不匹配,并在无法为您提供任何有用信息时拒绝使用 Flake8。 (Flake8 必须安装在与代码运行相同的 Python 版本上。)

  2. Elpy 似乎坚持要求您使用 virtualenv 或将 ~/.local/bin/ 添加到您的 PATH 中。我建议两者都做。

    您可以通过执行 virtualenv ~/.elpy-venv 创建 virtualenv 并使用 source ~/.elpy-venv/bin/activate 激活它。

    您可以编辑 Shell 的配置文件(例如,~/.bashrc~/.bash_profile~/.zshrc 等.) 执行导出 PATH="$PATH:~/.local/bin"

关于flake8 - 打开 python 文件时出现 Flymake 配置错误,但正确设置 flake,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44809649/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com