gpt4 book ai didi

python - Emacs Elpy 找不到包

转载 作者:太空宇宙 更新时间:2023-11-03 21:47:37 27 4
gpt4 key购买 nike

首先,如果我的问题很愚蠢,请原谅。但是,我无法解决我遇到的问题。

我将开始一个关于 Python 的项目,并希望使用 Emacs 作为默认编辑器。我想首先设置我的环境以便高效工作。在之前的项目中,我使用了现有的环境,但想在本地计算机上拥有自己的环境。我使用的是 Mac OS 10.12.6。

我首先下载了 Python2.7.10 和最新的 Emacs——版本 26.1。我读到 Elpy 是最好的 Python 开发环境之一,并下载了它。

这是我的 .emacs 文件。它位于我的主目录中(当然不是最佳目录)。

;; init.el --- Emacs configuration

;; INSTALL PACKAGES
;; --------------------------------------

(require 'package)

(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)

(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))

(defvar myPackages
'(better-defaults
elpy ;; add elpy package
material-theme))

(mapc #'(lambda (package)
(unless (package-installed-p package)
(package-install package)))
myPackages)

;; BASIC CUSTOMIZATION
;; --------------------------------------

(setq inhibit-startup-message t) ;; hide the startup message
(load-theme 'material t) ;; load material theme
(global-linum-mode t) ;; enable line numbers globally


;; init.el ends here
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
(python-environment elpygen py-autopep8 material-theme elpy better-
defaults))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

(elpy-enable)

在 Emacs 上,我想启用 Elpy。查看配置,我得到以下内容

Virtualenv........: None
RPC Python........: 2.7.10 (/usr/bin/python)
Interactive Python: python (/usr/bin/python)
Emacs.............: 26.1
Elpy..............: 1.24.0
Jedi..............: Not found
Rope..............: Not found
Autopep8..........: Not found
Yapf..............: Not found
Black.............: Not found
Syntax checker....: Not found (flake8)

...

The jedi package is not available. Completion and code navigation will
not work.

[run] easy_install --user jedi

...

我已经使用以下命令安装了 Jedi、Rope 等

pip install jedi, rope

通过单击“运行”,我收到以下消息:

Traceback (most recent call last):
File "/usr/bin/easy_install-2.7", line 7, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

我尝试了这个问题中所做的事情: No module named pkg_ressources 。我更新了当前版本的 pip、setuptools、distribute,...但没有任何效果。我应该删除所有内容并重新开始(如果不删除所有内容,可能会很危险)?

我真的不知道从哪里开始。重新安装 setuptool 包没有改变任何东西。

之前我安装了Python3.x,也许它搞砸了安装。

感谢任何帮助。

非常感谢。

最佳答案

据我所知current recommendation就是在你的虚拟环境中安装 Jedi/Rope。对于其他要求,您可能可以通过修改 $PATH 环境变量来摆脱困境。

关于python - Emacs Elpy 找不到包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52372992/

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