![升级到 Ubuntu 19.04 导致 pip 无法用于 python3.6](https://linux22.com/image/1590198/%E5%8D%87%E7%BA%A7%E5%88%B0%20Ubuntu%2019.04%20%E5%AF%BC%E8%87%B4%20pip%20%E6%97%A0%E6%B3%95%E7%94%A8%E4%BA%8E%20python3.6.png)
从 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 上。有人遇到同样的问题吗?