【发布时间】:2014-01-23 22:37:50
【问题描述】:
我希望使用 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
更新:我按照建议使用 conda update 更新了 anaconda 和 ipython,但仍然收到相同的错误消息。
更新 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 启动。
【问题讨论】:
-
你设置了
PYTHONPATH环境变量吗?
标签: python bash ipython anaconda