Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 如何在Dockerfile中本地安装pip包?_Git_Github_Docker_Pip - Fatal编程技术网

Git 如何在Dockerfile中本地安装pip包?

Git 如何在Dockerfile中本地安装pip包?,git,github,docker,pip,Git,Github,Docker,Pip,我正在尝试从github克隆一个python包,然后使用pip-e在本地安装它,如下所示: RUN git clone https://github.com/st4lk/django-rest-social-auth.git RUN pip install -e django-rest-social-auth 但我收到了错误信息: Step 6 : RUN pip install -e django-rest-social-auth ---> Running in 8943e68857

我正在尝试从github克隆一个python包,然后使用
pip-e
在本地安装它,如下所示:

RUN git clone https://github.com/st4lk/django-rest-social-auth.git
RUN pip install -e django-rest-social-auth
但我收到了错误信息:

Step 6 : RUN pip install -e django-rest-social-auth
 ---> Running in 8943e688573f
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 25, in <module>
    from requests.compat import IncompleteRead
ImportError: cannot import name IncompleteRead

已从中的
请求.compat中删除
未完成读取
名称

完成Dockerfile的此部分后

RUN apt-get update && apt-get install -y \
    git \
    python-django \
    python-psycopg2 \
    python-django-celery \
    rabbitmq-server \
    python-django-jsonfield \
    python-pip
您有版本2.4.3和PIP1.5.6的请求。这两个都很老了。下次运行
pip安装时

RUN pip install djangorestframework \
    python-social-auth
…这会将您的请求包升级到2.9.1,它不再与映像中安装的旧版本的
pip
兼容

您可以通过安装更新版本的
pip
来避免此问题。 只需使用
轻松安装
获取
pip

RUN apt-get update && apt-get install -y \
    git \
    python-django \
    python-psycopg2 \
    python-django-celery \
    rabbitmq-server \
    python-django-jsonfield

RUN easy_install pip

这将安装最新版本的
pip
,该版本将与后续Python模块安装所需的请求版本一起成功运行。

中的
未完成读取
名称已从
请求中删除。compat

完成Dockerfile的此部分后

RUN apt-get update && apt-get install -y \
    git \
    python-django \
    python-psycopg2 \
    python-django-celery \
    rabbitmq-server \
    python-django-jsonfield \
    python-pip
您有版本2.4.3和PIP1.5.6的请求。这两个都很老了。下次运行
pip安装时

RUN pip install djangorestframework \
    python-social-auth
…这会将您的请求包升级到2.9.1,它不再与映像中安装的旧版本的
pip
兼容

您可以通过安装更新版本的
pip
来避免此问题。 只需使用
轻松安装
获取
pip

RUN apt-get update && apt-get install -y \
    git \
    python-django \
    python-psycopg2 \
    python-django-celery \
    rabbitmq-server \
    python-django-jsonfield

RUN easy_install pip

这将安装最新版本的
pip
,该版本将与后续Python模块安装所需的请求版本一起成功运行。

谢谢你,larsks,我按照你的建议进行了构建。谢谢你,larsks,我现在按照你的建议进行了构建。