我希望使用 ipython 的 anaconda 发行版,但ipython
在终端输入会产生错误消息:
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: ipython==0.13.1
如下添加 PATH.bash_profile
会产生相同的错误消息。询问which python
产生//anaconda/bin/python
,which ipython
产生/usr/local/bin/ipython
。我该如何解决这个问题以ipython
启动 anaconda ipython?
# MacPorts Installer addition on 2012-11-03_at_23:50:01: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# Add colors to terminal
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# added by Anaconda 1.6.1 installer
export PATH="//anaconda/bin:$PATH"
export PATH=/anaconda//bin/isympy:$PATH
# added to Homebrew: bad command
export PATH=/usr/local/bin:$PATH
更新:我按照建议更新了 anaconda 和 ipython conda update
,但仍然收到相同的错误消息。
更新2:感谢所有建议。我修改/usr/local/bin/ipython
如下:
#!//anaconda/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'ipython==1.1.0','console_scripts','ipython'
__requires__ = 'ipython==1.1.0'
import sys
from pkg_resources import load_entry_point
sys.exit(
load_entry_point('ipython==1.1.0', 'console_scripts', 'ipython')()
)
现在which ipython
生成 //anaconda/bin/ipython 并ipython
启动。