Ipython notebook - fails to open

妖精的绣舞 提交于 2019-12-24 04:38:07

问题


I have tried to open ipython notebook without luck and don't know why?

When i type the command "ipython notebook", the output i receive is :

-bash: /usr/local/bin/ipython: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

Any help ?


回答1:


This issue can be caused by: multiple python installs, virtualenvs, and/or broken python path variable. If you are using homebrew on mac or anaconda distribution, it can also cause version conflicts with pip and subsequent package installations.

First thing to check is which python interpreter the system thinks it is using:

$ which python
$ which python2.7

this will tell you which is the currently activated python. Also check:

$ which ipython

My guess is that you have 2 or more versions of python installed on your system, and you used pip to get ipython for some active python version as specified by the path variable; pip got confused along the way.

Check your path variable in your bash settings (i.e. .bashrc or .profile), and you may want to set the version that you want. You would want to use the correct pip variant depending on whether you want to use /usr/local/bin/ or /opt/local/bin/python2.7.

Here's more info:

  • https://stackoverflow.com/a/27308244/3761363

  • https://stackoverflow.com/a/31769149/3761363

  • https://www.reddit.com/r/osxterminal/comments/33xte7/i_dont_understand_this_error_bash_usrlocalbinpip/



回答2:


I just got the same problem when I upgrade my python2.7 to python3 by using homebrew yesterday. Tried googled suggestions but no one really solved the problem. Then I checked the first line of my pip, pip3, ipython, ipython2, ipython3 and jupyter. Found the problem actually is that the first lines of jupyter and ipython2 still point to the old python2.7 path "/usr/local/opt/python/bin/python2.7" which is not exist anymore. So, I just changed the first line to "#!/usr/local/opt/python/bin/python3.6" for jupyter and the problem solved.



来源:https://stackoverflow.com/questions/32187398/ipython-notebook-fails-to-open

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!