我尝试使用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
答案 0 :(得分:0)
您似乎需要安装此软件包。
pip install docker_pycreds
http://packages.ubuntu.com/zesty/python-dockerpycreds
https://github.com/shin-/dockerpy-creds/blob/master/dockerpycreds/constants.py
由于您使用的是Debian衍生产品,因此它将包含在您的产品中。 有关dist / site-packages的详细信息,请参阅此帖子。
What's the difference between dist-packages and site-packages?
编辑:
您可能需要更新依赖项。
pip install urllib3==1.21
或
pip install --upgrade urllib3
和/或
pip install --upgrade pip