gpt4 book ai didi

python - 使用 pip3 : ModuleNotFoundError: No module named 'pip._vendor.packaging.__about__' 时出现错误

转载 作者:行者123 更新时间:2023-12-04 17:22:55 27 4
gpt4 key购买 nike

每当我尝试使用 pip3 或任何包含 pip3 的东西时,我都会收到以下错误:

ModuleNotFoundError: No module named 'pip._vendor.packaging.__about__' pops up.

我用它安装了opencv,昨天在多个项目中使用了opencv。我不知道为什么今天会弹出错误。

这是我的代码:

kaushiksankar@Kaushiks-MacBook-Pro ~ % pip3 install opencv-python
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/bin/pip3", line 5, in <module>
from pip._internal.cli.main import main
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py", line 12, in <module>
from pip._internal.utils.logging import get_indentation
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/utils/logging.py", line 17, in <module>
from pip._internal.utils.deprecation import DEPRECATION_MSG_PREFIX
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/utils/deprecation.py", line 13, in <module>
from pip._vendor.packaging.version import parse
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/packaging/__init__.py", line 6, in <module>
from .__about__ import (
ModuleNotFoundError: No module named 'pip._vendor.packaging.__about__'

我正在使用 MacOS。

我无法通过任何方法找到 pip 的版本。pip 命令无法使用,因此使用了 pip3

最佳答案

下载get-pip.py文件并将其存放在安装python的同一目录下。或者使用下面的命令直接下载pip

wget https://bootstrap.pypa.io/get-pip.py

现在使用下面的命令执行下载的文件:

python3 get-pip.py

可以通过执行版本检查轻松验证 pip 是否已正确安装。只需转到命令行并执行以下命令:

pip3 --version

之后,您可以安装您的包:

pip3 install package_name

关于python - 使用 pip3 : ModuleNotFoundError: No module named 'pip._vendor.packaging.__about__' 时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65090587/

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