我已经安装了Python2和Python3,但是当我从终端使用ipython
运行IPython时,它会启动Python2。我如何让IPython运行Python3?在IPython引用中,它指出您只需要从终端使用命令ipython3
,但这并不起作用。这个问题似乎在Stackoverflow上的其他地方也被问到了,但我没有看到一个非常明确的答案。
发布于 2015-08-10 02:14:34
您需要为python3安装ipython,您可以使用pip执行以下操作:
pip3 install ipython
然后,要启动ipython2
shell,只需输入ipython2
,对于ipython3
,请使用ipython3
发布于 2018-06-15 07:40:29
卸载然后重新安装我所有的ipython对我有效:
卸载:
brew uninstall ipython ## had a version installed w/ brew on my machine
pip2 uninstall ipython
pip3 uninstall ipython
使用pip2和pip3重新安装:
pip2 install ipython
pip3 install ipython
现在我知道ipython2
从2.7版开始,ipython
从3.6版开始:
mustache:~ r8t$ ipython
Python 3.6.5 (default, Apr 25 2018, 14:26:36)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: exit()
mustache:~ r8t$ ipython2
Python 2.7.15 (default, May 1 2018, 16:44:37)
Type "copyright", "credits" or "license" for more information.
IPython 5.7.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
https://stackoverflow.com/questions/31907119
复制相似问题