【发布时间】:2021-07-09 02:56:32
【问题描述】:
谁能告诉我为什么会出现这个错误? AWS 上的 Ubuntu 16.04
ubuntu@main:~$ pip3 --version
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 14, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 23, in <module>
from pip.locations import (
File "/usr/lib/python3/dist-packages/pip/locations.py", line 9, in <module>
from distutils import sysconfig
ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.9/distutils/__init__.py)
如果有帮助,这里有一些相关的输出:
ubuntu@main:~$ python3 --version
Python 3.9.4
ubuntu@main:~$ python --version
Python 2.7.12
ubuntu@main:~$ pip --version
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 20.3.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
ubuntu@main:~$
【问题讨论】:
-
试试
apt-get install -y --no-install-recommends python3.9-distutils
标签: python python-3.x ubuntu pip