无法使用 pip 安装软件包 - 版本不一致导致错误,但版本与元数据匹配

无法使用 pip 安装软件包 - 版本不一致导致错误,但版本与元数据匹配

我最近在尝试使用 pip 安装任何东西时遇到了问题。它一直尝试旧版本,并抱怨每个版本都不匹配,但实际上它们完全匹配。以下日志来自尝试升级 pip。

~$ pip3 install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /usr/lib/python3.10/site-packages (21.0)
Collecting pip
  Using cached pip-22.0.4-py3-none-any.whl (2.1 MB)
WARNING: Discarding https://files.pythonhosted.org/packages/4d/16/0a14ca596f30316efd412a60bdfac02a7259bf8673d4d917dc60b9a21812/pip-22.0.4-py3-none-any.whl#sha256=c6aca0f2f081363f689f041d90dab2a07a9a07fb840284db2218117a52da800b (from https://pypi.org/simple/pip/) (requires-python:>=3.7). Requested pip from https://files.pythonhosted.org/packages/4d/16/0a14ca596f30316efd412a60bdfac02a7259bf8673d4d917dc60b9a21812/pip-22.0.4-py3-none-any.whl#sha256=c6aca0f2f081363f689f041d90dab2a07a9a07fb840284db2218117a52da800b has inconsistent version: filename has '22.0.4', but metadata has '22.0.4'
  Using cached pip-22.0.4.tar.gz (2.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
WARNING: Discarding https://files.pythonhosted.org/packages/33/c9/e2164122d365d8f823213a53970fa3005eb16218edcfc56ca24cb6deba2b/pip-22.0.4.tar.gz#sha256=b3a9de2c6ef801e9247d1527a4b16f92f2cc141cd1489f3fffaf6a9e96729764 (from https://pypi.org/simple/pip/) (requires-python:>=3.7). Requested pip from https://files.pythonhosted.org/packages/33/c9/e2164122d365d8f823213a53970fa3005eb16218edcfc56ca24cb6deba2b/pip-22.0.4.tar.gz#sha256=b3a9de2c6ef801e9247d1527a4b16f92f2cc141cd1489f3fffaf6a9e96729764 has inconsistent version: filename has '22.0.4', but metadata has '22.0.4'
  Using cached pip-22.0.3-py3-none-any.whl (2.1 MB)
WARNING: Discarding https://files.pythonhosted.org/packages/6a/df/a6ef77a6574781a668791419ffe366c8acd1c3cf4709d210cb53cd5ce1c2/pip-22.0.3-py3-none-any.whl#sha256=c146f331f0805c77017c6bb9740cec4a49a0d4582d0c3cc8244b057f83eca359 (from https://pypi.org/simple/pip/) (requires-python:>=3.7). Requested pip from https://files.pythonhosted.org/packages/6a/df/a6ef77a6574781a668791419ffe366c8acd1c3cf4709d210cb53cd5ce1c2/pip-22.0.3-py3-none-any.whl#sha256=c146f331f0805c77017c6bb9740cec4a49a0d4582d0c3cc8244b057f83eca359 has inconsistent version: filename has '22.0.3', but metadata has '22.0.3'

情况一直这样,但软件包和元数据的版本完全匹配。通过 pacman 重新安装 python-pip 也无济于事。

编辑:我可以通过将 Pip 升级为 sudo 来解决这个问题(这使得它能够在整个系统范围内安装)

相关内容