我在//anaconda/bin/python中安装了本地Python
在命令提示符中
$python
>>import sys
>>print sys.executable
>>//anaconda/bin/python但是,在我的电子邮件中
M-x shell
bash-3.2$ python
>>import sys
>> print sys.executable
>> /usr/bin/python如何设置路径以在emacs shell中使用所需的Python?
发布于 2014-03-09 07:12:23
您需要设置emacs使用的PATH环境变量。
查看How do I make Emacs recognize bash environment variables for compilation?
具体来说:https://github.com/purcell/exec-path-from-shell
在OS上,从图形用户界面启动的Emacs实例将具有与终端窗口中的shell不同的环境,因为OS在登录期间不运行shell。显然,在调用外部实用程序(如make from Emacs )时,这将导致意外的结果。 这个库通过从用户的shell复制重要的环境变量来解决这个问题。
发布于 2014-03-09 07:36:29
正如疯狂的刺猬所写的,您需要在emacs中修改PATH环境变量。具体而言,根据init文件所在的位置,在~/.emacs或~/.emacs.d/init.el文件中添加这一行。
(setenv "PATH"
(concat
"//anaconda/bin:"
(getenv "PATH")
)
)发布于 2014-03-09 09:12:33
为了完整起见:在Linux中,只需从shell启动emacs就可以读取当前路径。
https://stackoverflow.com/questions/22279055
复制相似问题