Docker-compose 在任何调用时抛出错误

Docker-compose 在任何调用时抛出错误

我使用以下方式安装了 docker-composesudo apt-get install docker-compose

在任何调用中(即使只是使用标志获取版本-v),它都会抛出以下内容:

/usr/lib/python2.7/dist-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
  from cryptography import x509
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 11, in <module>
    load_entry_point('docker-compose==1.17.1', 'console_scripts', 'docker-compose')()
  File "/home/akost/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/akost/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/home/akost/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/home/akost/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 17, in <module>
    from . import errors
  File "/usr/lib/python2.7/dist-packages/compose/cli/errors.py", line 11, in <module>
    from docker.errors import APIError
  File "/usr/lib/python2.7/dist-packages/docker/__init__.py", line 2, in <module>
    from .api import APIClient
  File "/usr/lib/python2.7/dist-packages/docker/api/__init__.py", line 2, in <module>
    from .client import APIClient
  File "/usr/lib/python2.7/dist-packages/docker/api/client.py", line 6, in <module>
    import requests
  File "/home/akost/.local/lib/python2.7/site-packages/requests/__init__.py", line 84, in <module>
    from urllib3.contrib import pyopenssl
  File "/home/akost/.local/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 12, in <module>
    from cryptography import x509
  File "/home/akost/.local/lib/python2.7/site-packages/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/home/akost/.local/lib/python2.7/site-packages/cryptography/x509/base.py", line 23, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "/home/akost/.local/lib/python2.7/site-packages/cryptography/x509/extensions.py", line 28, in <module>
    from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
  File "/home/akost/.local/lib/python2.7/site-packages/cryptography/x509/general_name.py", line 14, in <module>
    from cryptography.x509.name import Name
  File "/home/akost/.local/lib/python2.7/site-packages/cryptography/x509/name.py", line 29, in <module>
    _ASN1_TYPE_TO_ENUM = {i.value: i for i in _ASN1Type}
TypeError: 'type' object is not iterable

这似乎是 Python 错误,我使用 pip2.7 重新安装了加密库,但仍然不起作用。任何指点都非常感谢!

运行 Ubuntu 18.04。

答案1

事实证明问题出在 python 上,'cryptography' 包中的某些内容阻止了 OpenSSL 的使用,因此使用 进行了修复rm -rf ~/.local/lib/python2.7/site-packages/cryptography

相关内容