使用 pip 安装 matplotlib 或 certifi 时出现问题

Problem installing matplotlib or certifi with pip

这是在基于手臂的机器上 运行ing arch linux。

 ERROR: Requested certifi>=2020.06.20 from https://files.pythonhosted.org/packages/5e/a0/5f06e1e1d463903cf0c0eebeb751791119ed7a4b3737fdc9a77f1cdfb51f/certifi-2020.12.5-py2.py3-none-any.whl#sha256=719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830 has different version in metadata: '2020.12.5'
    Traceback (most recent call last):
      File "/usr/lib/python3.9/site-packages/setuptools/installer.py", line 75, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmponkebyxp', '--quiet', 'certifi>=2020.06.20']' returned non-zero exit status 1.
 The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-94nlrun8/matplotlib/setup.py", line 256, in <module>
        setup(  # Finally, pass this all along to distutils to do the heavy lifting.
      File "/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 152, in setup
        _install_setup_requires(attrs)
      File "/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/lib/python3.9/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 766, in resolve
        dist = best[req.key] = env.best_match(
      File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1051, in best_match
        return self.obtain(req, installer)
      File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1063, in obtain
        return installer(requirement)
      File "/usr/lib/python3.9/site-packages/setuptools/dist.py", line 780, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/usr/lib/python3.9/site-packages/setuptools/installer.py", line 77, in fetch_build_egg
        raise DistutilsError(str(e)) from e
    distutils.errors.DistutilsError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmponkebyxp', '--quiet', 'certifi>=2020.06.20']' returned non-zero exit status 1.

我尝试了很多关于其他问题的答案,但 none 对我有帮助。

我 运行 的命令是 python -m pip install matplotlib

如果我 运行 python -m pip install certifi

也会发生同样的情况

我找到了解决方法。您几乎可以将任何 python 库作为包安装。这样做比 fiddle 和 python 更容易,因为我不经常使用它。