ImportError: No module named ssl_match_hostname when importing the docker SDK for Python

前端 未结 8 669
失恋的感觉
失恋的感觉 2021-02-04 03:49

In order to use the Docker SDK for Python, I\'m trying to import docker in a Python script, but it\'s resulting in an ImportError with the following tr

8条回答
  •  猫巷女王i
    2021-02-04 04:19

    Don't install it with other backports packages until fixed (if they fix it)

    Seen in https://bitbucket.org/ambv/configparser/issues/17/importerror-when-used-with-other-backports#comment-36669436 :

    Michał Górny

    Well, I just wanted to report the core issue here but it seems that other already have learned it the hard way.

    Long story short, you can't ever mix pkg_resources namespaces and pkgutil namespaces. It's explained in the Python packaging guide. Attempting to import both is probably the best way to cause random breakage for everyone. You have to decide on one of them, and use it consistently across all packages using the backports namespace.

    Now, the backports package seems to serve the sole purpose of claiming the namespace, and it uses pkgutil. So I'd suggest following that one.

提交回复
热议问题