当我尝试在 emacs 中打开 python 文件时出现以下错误:
can’t guess python indent offset, using defaults: 4
deferred error: (error searching for program: permission denied, python)
我的假设是 python 环境变量需要复制到 Emacs PATH 变量,因为我必须使用 bradleywright 的 path.el 对 Mac OS X 执行相同的操作脚本,但现在我需要为 Windows 7 做同样的事情。我怎样才能做到这一点?
init.el
(load "~/.emacs.d/path.el")
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)
(require 'jedi)
(setq jedi:server-command
(list "C:/Python33/python.exe" jedi:server-script))
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
(global-auto-complete-mode t)
(require 'ido)
(ido-mode t)
(add-to-list 'load-path "~/.emacs.d/elpa/magit-1.2.0/magit.el")
(require 'magit)
(require 'linum)
(global-linum-mode 1)
最佳答案
打开Python并使用sys.executable
获取Python的完整路径:
>>> import sys
>>> sys.executable
然后像这样设置jedi:server-command
:
(setq jedi:server-command
(list "THE-PATH-YOU-GOT" jedi:server-script))
另请参阅:http://tkf.github.io/emacs-jedi/latest/#jedi:server-command
请注意,您需要安装 Python 模块(即 epc 和 jedi),并且它们应该可以为此 Python 导入。因此请确保这在您的 Python 中有效:
>>> import epc, jedi
关于python - Emacs Jedi python 工具无法加载 "error searching for program: permission denied, python"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17412087/