如何将其他Python解释器设置为IPython

Sca*_*ass 3 python ipython

我们可以更改IPython使用的Python解释器的版本吗?

我知道有IPython和IPython3,但问题是,IPython使用Python2.7,而IPython3使用Python3.4.2,我认为没有办法改变它.

如果我希望IPython使用我想要的任何版本的Python解释器,我可以这样做吗?

我希望IPython使用最新的Python版本Python3.6.我能这样做吗?

小智 6

修改分布式文件应该是最后的手段.我建议在Ubuntu 17.04上使用python3.6作为示例:

python3.6 -m pip install IPython # lots of output, make IPython available to script ipython3
python3.6 `which ipython3`
Python 3.6.1 (default, Mar 22 2017, 06:17:05) 
[GCC 6.3.0 20170321] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Run Code Online (Sandbox Code Playgroud)


Sca*_*ass 3

看来我已经找到解决方案了。

您需要编辑启动 IPython 的文件。在 Linux 上,您可以使用以下命令输入:sudo nano $(which ipython)。进入文件后,将 shebang 行更改为您喜欢的 Python 解释器。并且包含Python3.4模块的目录需要添加到$PYTHONPATH变量中。

什么是舍邦线?文件中的第一行表示将使用的 python 解释器的路径。

感谢@code_byter。