编程语言
首页 > 编程语言> > ipython3在python3.7的终端中不起作用

ipython3在python3.7的终端中不起作用

作者:互联网

我最近从Python3.6升级到Python3.7.由于已经升级,因此在终端中输入ipython3时出现错误:

~$ipython3
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/usr/lib/python3/dist-packages/IPython/core/application.py", line 25, in <module>
    from IPython.core import release, crashhandler
  File "/usr/lib/python3/dist-packages/IPython/core/crashhandler.py", line 28, in <module>
    from IPython.core import ultratb
  File "/usr/lib/python3/dist-packages/IPython/core/ultratb.py", line 124, in <module>
    from IPython.utils import path as util_path
  File "/usr/lib/python3/dist-packages/IPython/utils/path.py", line 18, in <module>
    from IPython.utils.process import system
  File "/usr/lib/python3/dist-packages/IPython/utils/process.py", line 19, in <module>
    from ._process_posix import system, getoutput, arg_split, check_pid
  File "/usr/lib/python3/dist-packages/IPython/utils/_process_posix.py", line 24, in <module>
    import pexpect
  File "/usr/lib/python3/dist-packages/pexpect/__init__.py", line 75, in <module>
    from .pty_spawn import spawn, spawnu
  File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 14, in <module>
    from .spawnbase import SpawnBase
  File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 224
    def expect(self, pattern, timeout=-1, searchwindowsize=-1, async=False):
                                                                   ^
SyntaxError: invalid syntax

此外,我注意到我的jupyter-notebook现在似乎也不适用于python3内核(我收到了内核死错误).

笔记:

>当我将它们与Python2一起使用时,ipython和jupyter-notebook可以很好地工作.
>我正在使用Ubuntu 18.04(Bionic Beaver),尽管我认为这无关紧要

解决方法:

更新请更新您已安装的软件包.
已报告此pexpect错误,并已关闭issue

在Python 3.7中,async和await现在是保留关键字.这就是破坏某些已安装软件包的原因.

如果不需要3.7中的新功能,请回滚至3.6,然后等待软件包更新以支持3.7中的新语法.

What’s New in Python 3.7

标签:python,jupyter-notebook,ipython,python-3-7
来源: https://codeday.me/bug/20191010/1888586.html