emacs和python环境 [英] emacs and python environment
问题描述
我在 // anaconda / bin / python
中的本地Python安装在命令提示符下
In the command prompt
$python
>>import sys
>>print sys.executable
>>//anaconda/bin/python
但是,在emacs中,我得到
but, in emacs I get
M-x shell
bash-3.2$ python
>>import sys
>> print sys.executable
>> /usr/bin/python
如何设置我的路径在emacs shell中使用所需的Python ?
How can I set my path to use the desired Python in the emacs shell?
推荐答案
您需要设置emac使用的PATH环境变量。
You need to set the PATH environment variable that emacs uses.
具体来说:
https://github.com/purcell/exec-path-from-shell
在OS X上,从图形用户界面
启动的Emacs实例与终端窗口中的shell将有不同的环境,
,因为OS X不运行shell在登录过程中。显然,这个
会导致外部实用程序(如
从Emacs调用)时出现意想不到的结果。
On OS X, an Emacs instance started from the graphical user interface will have a different environment than a shell in a terminal window, because OS X does not run a shell during the login. Obviously this will lead to unexpected results when calling external utilities like make from Emacs.
此库可以通过复制重要的$ b来解决此问题$ b来自用户shell的环境变量。
This library works around this problem by copying important environment variables from the user's shell.
这篇关于emacs和python环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!