我的mac上的以下文件夹中有python库
/usr/local/lib/python2.7/site-packages/
/usr/local/lib/python3.6/site-packages/
和,相应的二进制文件为以下文件
/usr/local/bin/python2.7
/usr/local/bin/python3.6
但是,ipython二进制文件在/usr/local/Cellar/ipython/6.2.1/bin/ipython
中,而ipython文件/usr/local/bin/ipython
中包含以下行 -
PYTHONPATH="/usr/local/Cellar/ipython/6.2.1/libexec/lib/python3.6/site-packages:/usr/local/Cellar/ipython/6.2.1/libexec/vendor/lib/python3.6/site-packages" exec "/usr/local/Cellar/ipython/6.2.1/libexec/bin/ipython" "$@"
因此,在终端中执行ipython时,系统将默认解释器视为python3.6。如何修改这些文件以将python解释器从3.6更改为2.7?
以下是我的mac中所有ipython *文件的屏幕截图。
答案 0 :(得分:1)
从版本6开始,IPython不再与Python 2.x兼容。
你可以继续使用IPython 6和Python 3,或者降级到IPython 5并使用Python 2。
http://ipython.readthedocs.io/en/stable/whatsnew/version6.html#ipython-6-0 https://github.com/Homebrew/brew/issues/2849