我尝试使用安装docker-compose
,pip
但出现此错误:
$ docker-compose
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py",
line 17, in <module>
from . import errors
File "/usr/local/lib/python2.7/dist-
packages/compose/cli/errors.py", line 11, in <module>
from docker.errors import APIError
File "/usr/local/lib/python2.7/dist-packages/docker/__init__.py",
line 2, in <module>
from .api import APIClient
File "/usr/local/lib/python2.7/dist-
packages/docker/api/__init__.py", line 2, in <module>
from .client import APIClient
File "/usr/local/lib/python2.7/dist-
packages/docker/api/client.py", line 11, in <module>
from .build import BuildApiMixin
File "/usr/local/lib/python2.7/dist-packages/docker/api/build.py",
line 6, in <module>
from .. import auth
File "/usr/local/lib/python2.7/dist-packages/docker/auth.py", line
6, in <module>
import dockerpycreds ImportError: No module named dockerpycreds
更新 1:安装 docker_pycreds 后,如答案所述,它导致我出现另一个错误:
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py",
line 17, in <module>
from . import errors
File "/usr/local/lib/python2.7/dist-packages/compose/cli/errors.py",
line 11, in <module>
from docker.errors import APIError
File "/usr/local/lib/python2.7/dist-packages/docker/__init__.py",
line 2, in <module>
from .api import APIClient
File "/usr/local/lib/python2.7/dist-
packages/docker/api/__init__.py", line 2, in <module>
from .client import APIClient
File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py",
line 11, in <module>
from .build import BuildApiMixin
File "/usr/local/lib/python2.7/dist-packages/docker/api/build.py",
line 9, in <module>
from .. import utils
File "/usr/local/lib/python2.7/dist-
packages/docker/utils/__init__.py", line 2, in <module>
from .build import tar, exclude_paths
File "/usr/local/lib/python2.7/dist-packages/docker/utils/build.py",
line 4, in <module>
from .utils import create_archive
File "/usr/local/lib/python2.7/dist-packages/docker/utils/utils.py",
line 18, in <module>
from .. import tls
File "/usr/local/lib/python2.7/dist-packages/docker/tls.py", line 5,
in <module>
from .transport import SSLAdapter
File "/usr/local/lib/python2.7/dist-
packages/docker/transport/__init__.py", line 3, in <module>
from .ssladapter import SSLAdapter
File "/usr/local/lib/python2.7/dist-
packages/docker/transport/ssladapter.py", line 22, in <module>
urllib3.connection.match_hostname = match_hostname
AttributeError: 'module' object has no attribute 'connection'
更新2:在pip install -U urllib3==1.14
另一个答案指出之后,错误变为:
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py",
line 17, in <module>
from . import errors
File "/usr/local/lib/python2.7/dist-packages/compose/cli/errors.py",
line 13, in <module>
from requests.exceptions import ReadTimeout
ImportError: cannot import name ReadTimeout