无法让IPython运行Python 2.7而不是3.5

2024-05-28 23:43:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我在ArchLinux上尝试让IPython运行Python2.7而不是Python3.5。 我已经编辑了/usr/bin/ipython,如下所示:

#!/usr/bin/python
# This script was automatically generated by setup.py
if __name__ == '__main__':
    from IPython import start_ipython
    start_ipython()

在第一行我换了

^{pr2}$

#!/usr/bin/python2.7

但在那之后,当我尝试运行IPython时,我收到了这样一条消息:

Traceback (most recent call last):
  File "/usr/bin/ipython", line 4, in <module>
    from IPython import start_ipython
ImportError: No module named IPython

我想知道在输入ipython时运行Python2.7,在输入ipython3时运行Python3需要做些什么


Tags: fromimport编辑binusripythonscriptthis

热门问题