我以前在python2.7上安装了ipython。 我使用
安装python3-pip
后
$sudo apt-get install python3-pip
并运行以下命令
$sudo pip3 install ipython
,我无法启动ipython
。
我收到以下错误:
kv@kv:~$ ipython
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 7, in <module>
from IPython import start_ipython
File "/usr/lib/python2.7/dist-packages/IPython/__init__.py", line 43, in <module>
from .config.loader import Config
File "/usr/lib/python2.7/dist-packages/IPython/config/loader.py", line 165
except KeyError, e:
^
SyntaxError: invalid syntax
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 20, in <module>
import apt
File "/usr/lib/python2.7/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: /usr/lib/python2.7/dist-packages/apt_pkg.so: undefined symbol: _Py_ZeroStruct
Original exception was:
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 7, in <module>
from IPython import start_ipython
File "/usr/lib/python2.7/dist-packages/IPython/__init__.py", line 43, in <module>
from .config.loader import Config
File "/usr/lib/python2.7/dist-packages/IPython/config/loader.py", line 165
except KeyError, e:
^
SyntaxError: invalid syntax
如何在ipython
和python2.7
python3.4
开展工作
更新:
kv@kv:~$ ipython2
No command 'ipython2' found, did you mean:
Command 'python2' from package 'python-minimal' (main)
Command 'ipython' from package 'ipython' (universe)
Command 'ipython3' from package 'ipython3' (universe)
ipython2: command not found
和kv@kv:~$ ipython3
我收到前面提到的错误
答案 0 :(得分:0)
对我来说,下面的命令可以移动b / w python版本。
启动ipyton for python 2
$ ipython2
启动ipython for python 3
$ ipython3