从 18.04 升级到 19.04 后,我无法在装有 python3.6 的 virtualenvs 上使用 pip。
$ pip install scipy
Traceback (most recent call last):
File "/home/xen0f0n/dibco_local/dibco_python/bin/pip", line 7, in <module>
from pip._internal import main
File "/home/xen0f0n/dibco_local/dibco_python/lib/python3.6/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/xen0f0n/dibco_local/dibco_python/lib/python3.6/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/xen0f0n/dibco_local/dibco_python/lib/python3.6/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/home/xen0f0n/dibco_local/dibco_python/lib/python3.6/site-packages/pip/_internal/cli/cmdoptions.py", line 14, in <module>
from distutils.util import strtobool
File "/home/xen0f0n/dibco_local/dibco_python/lib/python3.6/distutils/__init__.py", line 25, in <module>
from distutils import dist, sysconfig
ImportError: cannot import name 'dist'
当尝试重新创建虚拟环境时
$ virtualenv my_python -p /usr/bin/python3.6
Running virtualenv with interpreter /usr/bin/python3.6
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 25, in <module>
import distutils.sysconfig
ModuleNotFoundError: No module named 'distutils.sysconfig'
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
ModuleNotFoundError: No module named 'apport'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 25, in <module>
import distutils.sysconfig
ModuleNotFoundError: No module named 'distutils.sysconfig'
我认为问题出在 python3-distutils 上。有人遇到同样的问题吗?