帮助让iPython从OSX终端运行


3

从stackoverflow.com站起来问这里的问题。

我正在浏览matplotlib文档并准备使用iPython交互式Python shell ipython -pylab。但是我得到了这个:

MBP:~ Me$ ipython -pylab
-bash: ipython: command not found

我没有安装iPython吗?我easy_install按照建议使用了。

有任何想法吗?

更新

我以为我只是说/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin在进行Spotlight搜索后我发现了iPython“可执行文件” 。

对于做什么仍然有点困惑。

Answers:


3

看起来你的Python 2.6安装是通过MacPorts,基于/opt/local前缀。如果您没有使用MacPorts安装它并且有自己的使用理由/opt/local,请忽略此答案。如果你这样做,你可以安装ipython port

port install py26-ipython

确保将$PATH环境变量设置为include /opt/local/bin。这应该由MacPorts安装程序完成。我~/.profile看起来像:

# MacPorts Installer addition on 2009-03-05_at_21:11:52: 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.


# MacPorts Installer addition on 2009-03-05_at_21:11:52: adding an appropriate MANPATH variable for use with MacPorts.
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.

我会小心地将easy_install与MacPorts python结合使用,特别是对于MacPorts已经提供的模块。例如,MacPorts ipython将可执行文件放在/opt/local/bin/ipython2.6一起/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipython

编辑
要卸载easy_installed版本的ipython,据我所知,您需要手动删除相关文件。我根据我的ipython安装进行了一次飞跃。首先删除可执行文件:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipcluster
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipcontroller
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipengine
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/iptest
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipython
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipython-wx
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipythonx
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/irunner
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/pycolor

然后,删除site-packages中的文件夹和egg-info:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ipython-0.10-py2.6.egg-info

然后,删除doc文件夹:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/doc/ipython/

然后,删除man文件:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipcluster.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipcontroller.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipengine.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipython-wx.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipython.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipythonx.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/irunner.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/pycolor.1.gz

最后,打开文件/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/easy-install.pth,查看是否有引用ipython egg的行。删除它。


哦,我想我可能做了一些noobish并确实安装iPython使用的东西easy_install。一位朋友在11月左右安装了使用MacPorts安装的Python 2.6.4。我认为他设置它使得我可以在终端上运行Python而不深入研究/opt/local/bin- 这是否有意义我可以在终端中键入并运行python因为那样?是的,我对这个Unix / Linux / MacOSX的东西还很绿......
PizzAzzra 2010年

PS - 如何卸载easy_install版本iPython
PizzAzzra 2010年

1
非常感谢:)这解决了愚蠢的easy_install业务。然后我试图运行port -v selfupdate之后sudo port install py26-ipython,然后我大吃一惊,因为它试图安装gettextsqlite3继而又我的Python升级从2.6.4到2.6.5 ...
PizzAzzra

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.