gpt4 book ai didi

python - 尝试在 Ubuntu 16.04 上运行 pip3 时出错

转载 作者:行者123 更新时间:2023-12-04 18:48:53 25 4
gpt4 key购买 nike

谁能告诉我为什么会出现这个错误? 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:~$

最佳答案

  • 尝试重新安装 pip :
    sudo apt remove python3-pip
    同步
    sudo apt 更新 && sudo apt 升级 -y
    sudo apt install python3-pip
  • 这只是一个警告信息。如果您不想看到它们,请使用“-W”键来避免警告:
    python -W --version
  • 关于python - 尝试在 Ubuntu 16.04 上运行 pip3 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67085291/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com