我同时安装了python 2.7和3.5。如果我使用命令行从命令行运行脚本python
,它将使用Python 2.7,但是如果启动iPython,它将使用Python 3:
kurt@kurt-ThinkPad:~$ python -V
Python 2.7.12
kurt@kurt-ThinkPad:~$ ipython
Python 3.5.2 (default, Sep 10 2016, 08:21:44)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.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.
In [1]:
有没有办法启动iPython使其使用Python 2?(我正在使用Ubuntu LTS 16.04)。
在ipython读取错误的python版本之后/usr/local/bin/ipython
,我只是更改了
#!/usr/bin/python3
在第一行中
#!/usr/bin/python
并且Python 2已成为iPython使用的默认版本:
kurt@kurt-ThinkPad:~$ ipython
Python 2.7.12 (default, Jul 1 2016, 15:12:24)
Type "copyright", "credits" or "license" for more information.
IPython 2.4.1 -- 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.
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句