所以,我想在我的Python虚拟环境中将我的pip降级到版本
pip==21
。问题是,在大多数情况下,当尝试运行降级的点时,它会给我同样的错误:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\Jaros\pva_projekt\.venv\Scripts\pip.exe\__main__.py", line 4, in <module>
from pip._internal.cli.main import main
File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\main.py", line 8, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\cmdoptions.py", line 22, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\progress_bars.py", line 9, in <module>
from pip._internal.utils.logging import get_indentation
File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\utils\logging.py", line 14, in <module>
from pip._internal.utils.misc import ensure_dir
File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\utils\misc.py", line 20, in <module>
from pip._vendor import pkg_resources
File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 58, in <module>
from pip._vendor.six.moves import urllib, map, filter
ModuleNotFoundError: No module named 'pip._vendor.six.moves'
我尝试过的最明显的事情是
python -m pip install pip==21
。它“成功安装了 pip-21.0”,但是当我尝试使用它或输入 pip --version
时,它输出了相同的错误。我也尝试过python get-pip.py pip==21.0
,但没有成功。然后我尝试了:
python -m ensurepip --upgrade
python -m pip install pip==21.0
那也毫无作用。我也尝试过这个:
python -m pip install --force-reinstall pip==21.0
但没有成功。我也在 virtualenv 之外尝试过,它似乎给了我同样的错误。
所以我通过降级到python 3.9.7
解决了
我的问题,它使用我需要的pip版本,但当尝试在
pip==21
上将pip降级到python 3.13.0
时,我仍然不知道是什么导致了这个错误,但正如 @flexter 所建议的,pip 21.0
可能与此版本不兼容。