2013-08-16 96 views
2

不久前我在OSX上使用brew和pip或easy_install安裝了python科學環境(numpy,scipy,matplotlib,pandas,ipython)(或者其中的2個,我沒有記得)。現在,如果嘗試運行IPython中,我得到:ipython:在OSX上找不到的命令

-> ipython 
-bash: ipython: command not found 

然後我做:

-> sudo find . -iname "*ipython*" 
Password: 
find: ./dev/fd/3: Not a directory 
find: ./dev/fd/4: Not a directory 
./Users/jfk/.ipython 
./usr/local/Cellar/matplotlib/1.2.0/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.py 
./usr/local/Cellar/matplotlib/1.2.0/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.pyc 
./usr/local/Cellar/matplotlib/1.2.0/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.py 
./usr/local/Cellar/matplotlib/1.2.0/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyc 
./usr/local/Cellar/matplotlib/1.2.1/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.py 
./usr/local/Cellar/matplotlib/1.2.1/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.pyc 
./usr/local/Cellar/matplotlib/1.2.1/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.py 
./usr/local/Cellar/matplotlib/1.2.1/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyc 
./usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/share/doc/ipython 
./usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/share/doc/ipython/examples/core/ipython-get-history.py 
./usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/share/doc/ipython/examples/core/ipython-qtconsole.desktop 
./usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/share/doc/ipython/examples/core/ipython-sh.desktop 
./usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/share/doc/ipython/examples/core/ipython.desktop 
./usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/share/doc/ipython/examples/core/ipython_here_shell_extension.reg 
./usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/share/man/man1/ipython.1 
./usr/local/lib/python2.7/site-packages/IPython 
./usr/local/lib/python2.7/site-packages/IPython/config/profile/cluster/ipython_config.py 
./usr/local/lib/python2.7/site-packages/IPython/config/profile/cluster/ipython_config.pyc 
./usr/local/lib/python2.7/site-packages/IPython/config/profile/math/ipython_config.py 
./usr/local/lib/python2.7/site-packages/IPython/config/profile/math/ipython_config.pyc 
./usr/local/lib/python2.7/site-packages/IPython/config/profile/pysh/ipython_config.py 
./usr/local/lib/python2.7/site-packages/IPython/config/profile/pysh/ipython_config.pyc 
./usr/local/lib/python2.7/site-packages/IPython/config/profile/sympy/ipython_config.py 
./usr/local/lib/python2.7/site-packages/IPython/config/profile/sympy/ipython_config.pyc 
./usr/local/lib/python2.7/site-packages/IPython/frontend/html/notebook/static/codemirror/README-IPython.rst 
./usr/local/lib/python2.7/site-packages/IPython/frontend/html/notebook/static/codemirror/theme/ipython.css 
./usr/local/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py 
./usr/local/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.pyc 
./usr/local/lib/python2.7/site-packages/IPython/frontend/qt/console/resources/icon/IPythonConsole.svg 
./usr/local/lib/python2.7/site-packages/IPython/frontend/qt/console/rich_ipython_widget.py 
./usr/local/lib/python2.7/site-packages/IPython/frontend/qt/console/rich_ipython_widget.pyc 
./usr/local/lib/python2.7/site-packages/ipython-0.13.2-py2.7.egg-info 
./usr/local/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.py 
./usr/local/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_console_highlighting.pyc 
./usr/local/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.py 
./usr/local/lib/python2.7/site-packages/matplotlib/sphinxext/ipython_directive.pyc 
./usr/local/share/python/ipython 

我很驚訝,沒有看到任何/ bin目錄。

然後我試圖重新安裝IPython的

-> pip install ipython 
Requirement already satisfied (use --upgrade to upgrade): ipython in /usr/local/lib/python2.7/site-packages 
Cleaning up... 

這實在是令人困惑的。任何想法是受歡迎的。

+0

你確定你調用的pip屬於Homebrew的Python嗎?從你的文件列表中看來,你已經在你的系統Python中安裝了'ipython',所以它已經把可執行文件放到''/ usr/local/share/python''中。 – fjarri

回答

5

創建您$HOME以下內容.pydistutils.cfg

[global] 
verbose=1 

[install] 
install-scripts=$HOME/bin 

[easy_install] 
install-scripts=$HOME/bin 

運行

pip install -U --user --force ipython 

看一看https://github.com/pypa/pip/issues/426

+3

您的建議會導致錯誤:無法將用戶與前綴,exec_prefix/home或install_(plat)base組合在一起。我能夠使用這個http://stackoverflow.com/questions/4495120/combine-user-with-prefix-error-with-setup-py-install來更正它。現在ipython正常工作。 –

0

解決方法(至少對於IPython中)是將這些行添加到~/.pydistutils.cfg [install] install-data=/usr/local install-scripts=/usr/local/bin