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

7

当我尝试安装ruamel.yaml包时,出现了错误。

以下是命令:

python --version;pip --version;pip install ruamel.yaml

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

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/8j/69k5q3yn4y51g5nt2g7g9b9n24s68p/T/pip-install-htyM8C/ruamel.yaml/

为了先给您提供一些背景信息,我使用brew安装了Python3,但后来又卸载了它。

现在,我无法安装 ruamel.yaml。

有人遇到过同样的问题吗?您是怎么解决的呢?


我正在尝试在虚拟环境中安装它,现在出现以下提示:"收集ruamel.yaml时无法获取URL https://pypi.python.org/simple/ruamel-yaml/。存在确认ssl证书的问题:[SSL:TLSV1_ALERT_PROTOCOL_VERSION] tlsv1警报协议版本(_ssl.c:590) - 跳过 找不到满足要求ruamel.yaml(来自版本的版本:) 没有找到匹配的分发。" - David
关于您的第二个问题,请参考以下链接:https://dev59.com/klUL5IYBdhLWcg3wzqyZ。至于您的第一个问题,也许您需要更新*pkg\_resources*或*pip*? - CristiFati
2个回答

5

我通过将Python版本从3.10.+ 降级到 3.9.+ 成功解决了这个问题。


将Python版本降级到3.9.+对我也起作用了。 - ace_racer

5

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

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接