让IPython使用Python 3而不是Python 2运行

让IPython使用Python 3而不是Python 2运行,python,python-3.x,ipython,Python,Python 3.x,Ipython,我安装了Python2和Python3,但当我从终端使用IPython运行IPython时,它会启动Python2。如何让IPython运行Python 3呢?在IPython引用中,它说您只需要从终端使用命令ipython3,但这不起作用。这个问题似乎在Stackoverflow的其他地方被问到,但我看不到一个非常明确的答案。您需要为python3安装ipython,您可以使用pip: pip3 install ipython 然后要启动ipython2shell,只需键入ipython2,

我安装了Python2和Python3,但当我从终端使用
IPython
运行IPython时,它会启动Python2。如何让IPython运行Python 3呢?在IPython引用中,它说您只需要从终端使用命令
ipython3
,但这不起作用。这个问题似乎在Stackoverflow的其他地方被问到,但我看不到一个非常明确的答案。

您需要为python3安装ipython,您可以使用pip:

pip3 install ipython

然后要启动
ipython2
shell,只需键入
ipython2
,对于
ipython3
使用
ipython3
卸载然后重新安装我的所有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.

你安装了ipython3吗
pip3安装ipython
?如果您第一次安装
ipython
时有Python2,即使您以后安装Python3,它也将使用Python2运行。也许会有帮助。更改系统python环境路径。@SDilmac,你为什么建议这样做?@dsaxton,
pip3安装ipython
,然后只需使用
ipython
ipython3
,不需要做任何其他事情。设置
ipython
将实际为您提供最近安装的版本。在OSX中,我无法使用ipython3启动py3版本,如何解决这个问题?