Pip*_*ppi 6 python bash ipython anaconda
我希望使用anaconda分发ipython,但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
.bash_profile如下所示添加PATH 会产生相同的错误消息.要求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启动.
你的问题出现在$ PATH中.如果你看一下你的追溯,它正在运行/ usr/local/bin/ipython--这是由Homebrew安装的,而不是由Anaconda安装的.(Anaconda将所有东西安装到/ anaconda/bin.)
之所以这么做是因为你的.bash_profile的最后一行在你路径的前面贴了/ usr/local/bin.这意味着您通过Homebrew安装的ipython正在屏蔽Anaconda安装的ipython.
您有两种选择:
卸载Homebrew安装的ipython,只需使用Anaconda作为Python包.
在.bash_profile中,将Homebrew PATH修改行移到Anaconda上面.这样,Anaconda的ipython,python和各种其他Python命令将优先.
请记住,如果更改.bash_profile,则需要关闭终端并启动新终端以使更改生效.