I recently upgraded from Python3.6 to Python3.7. Since I have upgraded, when I type in ipython3 in the terminal I get an error:
~$ ipython3
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3/dist-packages/IPython/__init__.py", line 48, in
from .core.application import Application
File "/usr/lib/python3/dist-packages/IPython/core/application.py", line 25, in
from IPython.core import release, crashhandler
File "/usr/lib/python3/dist-packages/IPython/core/crashhandler.py", line 28, in
from IPython.core import ultratb
File "/usr/lib/python3/dist-packages/IPython/core/ultratb.py", line 124, in
from IPython.utils import path as util_path
File "/usr/lib/python3/dist-packages/IPython/utils/path.py", line 18, in
from IPython.utils.process import system
File "/usr/lib/python3/dist-packages/IPython/utils/process.py", line 19, in
from ._process_posix import system, getoutput, arg_split, check_pid
File "/usr/lib/python3/dist-packages/IPython/utils/_process_posix.py", line 24, in
import pexpect
File "/usr/lib/python3/dist-packages/pexpect/__init__.py", line 75, in
from .pty_spawn import spawn, spawnu
File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 14, in
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
Furthermore I have noticed that my jupyter-notebook does not seem to work with the python3 kernel now as well (I get the kernel dead error).
NOTEs:
ipython and jupyter-notebook are working with fine when I use them with Python2.
I am using Ubuntu 18.04 (Bionic Beaver) although I don't think this is relevant
解决方案
UPDATE Please update your installed packages.
This error for pexpect has been reported and closed already issue
In Python 3.7, async and await are now reserved keywords. This is what is breaking some of your installed packages.
If you do not need the new features in 3.7, roll back to 3.6 and wait until your packages are updated to support the new syntax in 3.7