首先,如果我的问题很愚蠢,请原谅。但是,我无法解决遇到的问题。
我将开始一个关于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,也许它弄乱了安装。
感谢您的帮助。
非常感谢。