python - Emacs Jedi python 工具无法加载 "error searching for program: permission denied, python"?

标签 python emacs elisp path-variables python-jedi

当我尝试在 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/

相关文章:

python - 单元测试基类是好的做法吗? ( python /webapp2)

regex - 根据列号应用面部颜色

emacs - 如何禁用特定类型文件的语义

emacs - 在括号内显示括号 - Emacs

emacs 24 主题和继承属性

emacs - 如何使用 ielm 在 Emacs lisp 中打印字符串?

python - geopandas 中 shapely 的缩放函数返回相似大小的点

python - 如何在 TensorFlow 中评估 MNIST 测试数据期间从每个输出节点获取值?

python - 如何使用 ctypes 从 Python 创建 C 结构体?

emacs - 在 Emacs 中重复输入变量名的快速方法?