根据官网指导安装docker-compose,结果测试docker-compose --version报错如下,根据提示可知是enum的问题。因为电脑同时安装了具有相同命名空间的enum和enum34,所以导致调用冲突。

root@k8s-master:~$ docker-compose --version
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.8.0', 'console_scripts', 'docker-compose')()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2691, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2322, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2328, 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 ..bundle import get_image_digests
  File "/usr/lib/python2.7/dist-packages/compose/bundle.py", line 14, in <module>
    from .service import format_environment
  File "/usr/lib/python2.7/dist-packages/compose/service.py", line 87, in <module>
    @enum.unique
AttributeError: 'module' object has no attribute 'unique'

解决方案:

pip uninstall enum enum34
pip install enum34
docker-compose --version

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐