这里写图片描述

docker-compose是python写的,使用pip install docker-compose安装的docker-compose有的时候会提示pkg_resources.DistributionNotFound的错误信息,
很多时候都是由于backports.ssl_match_hostname版本的问题,升级backports.ssl_match_hostname一般可以解决该问题。

现象

[root@liumiaocn ~]# docker-compose version
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3011, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 626, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: backports.ssl-match-hostname>=3.5
[root@liumiaocn ~]#

升级backports.ssl_match_hostname

[root@liumiaocn ~]# pip install backports.ssl_match_hostname --upgrade
Collecting backports.ssl_match_hostname
  Downloading backports.ssl_match_hostname-3.5.0.1.tar.gz
Installing collected packages: backports.ssl-match-hostname
  Found existing installation: backports.ssl-match-hostname 3.4.0.2
    Uninstalling backports.ssl-match-hostname-3.4.0.2:
      Successfully uninstalled backports.ssl-match-hostname-3.4.0.2
  Running setup.py install for backports.ssl-match-hostname ... done
Successfully installed backports.ssl-match-hostname-3.5.0.1
[root@liumiaocn ~]#

结果再确认

[root@liumiaocn ~]# docker-compose version
docker-compose version 1.8.1, build 878cff1
docker-py version: 1.10.4
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
[root@liumiaocn ~]#
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐