使用 pip 安装 ruamel.yaml 包时出现 Python 错误

Bec*_*cks 7 python installation yaml pip ruamel.yaml

当我想安装 ruamel.yaml 包时收到错误

\n\n

这是命令:

\n\n
python --version;pip --version;pip install ruamel.yaml\n
Run Code Online (Sandbox Code Playgroud)\n\n

和输出:

\n\n
Python 2.7.10\npip 10.0.0 from /Library/Python/2.7/site-packages/pip (python 2.7)\nCollecting ruamel.yaml\n  Downloading https://files.pythonhosted.org/packages/c1/ad/9557a78f1b61951623c56225e05dacdd81f80519f13fc39a926a5793edfa/ruamel.yaml-0.15.37.tar.gz (280kB)\n    100% |\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88| 286kB 4.4MB/s\n    Complete output from command python setup.py egg_info:\n    sys.argv [\'-c\', \'egg_info\', \'--egg-base\', \'pip-egg-info\']\n    Traceback (most recent call last):\n      File "<string>", line 1, in <module>\n      File "/private/var/folders/8j/69k5q3yn4y51g5nt2g7g9b9n24s68p/T/pip-install-htyM8C/ruamel.yaml/setup.py", line 917, in <module>\n        main()\n      File "/private/var/folders/8j/69k5q3yn4y51g5nt2g7g9b9n24s68p/T/pip-install-htyM8C/ruamel.yaml/setup.py", line 905, in main\n        setup(**kw)\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup\n        _setup_distribution = dist = klass(attrs)\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 272, in __init__\n        _Distribution.__init__(self,attrs)\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 287, in __init__\n        self.finalize_options()\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 326, in finalize_options\n        ep.require(installer=self.fetch_build_egg)\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2385, in require\n        reqs = self.dist.requires(self.extras)\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2617, in requires\n        dm = self._dep_map\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2606, in _dep_map\n        if invalid_marker(marker):\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1424, in is_invalid_marker\n        cls.evaluate_marker(text)\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1549, in _markerlib_evaluate\n        env = cls._translate_metadata2(_markerlib.default_environment())\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1537, in _translate_metadata2\n        for key, value in env\n      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1536, in <genexpr>\n        (key.replace(\'.\', \'_\'), value)\n    ValueError: too many values to unpack\n\n    ----------------------------------------\nCommand "python setup.py egg_info" failed with error code 1 in /private/var/folders/8j/69k5q3yn4y51g5nt2g7g9b9n24s68p/T/pip-install-htyM8C/ruamel.yaml/\n
Run Code Online (Sandbox Code Playgroud)\n\n

提供一些背景知识。我用brew安装了python3,然后又卸载了它。

\n\n

现在我无法安装 ruamel.yaml

\n\n

有人遇到同样的问题吗?\n你是怎么解决的?

\n

Ant*_*hon 5

您应该执行pip list并检查您的 setuptools 版本应该是(28.8.0)。如果您有旧版本,请使用 进行升级pip install -U setuptools

您应该考虑从 2.7.10 升级到较新版本的 Python 2(当前为 2.7.14),这应该可以解决您的 SSL 问题。如果您在 Linux 上运行,请确保不要覆盖系统 python。


Thu*_*raJ 5

我能够通过将 python 版本从 3.10.+ 降级到 3.9.+ 来解决此问题