机器人 救救瓜
Toggle navigation
Home
SCM-tool
Linux
Jenkins
SVN
other
About Me
Archives
Tags
Docker build 里的pip install 执行不成功
? python ?
? docker ?
2020-07-14 15:38:22
1247
0
0
gua_l
? python ?
? docker ?
</br> Dockerfile 里的 pip install 总是failed .但是直接执行可以成功。 估计是docker build 时默认使用的pip 源有太慢导致 </br> ### Dockerfile 里涉及的报错语句 ``` RUN pip install networkx ``` </br> ### 报错如下 ``` Step 9/15 : RUN pip install networkx ---> Running in 3a3f19067b2f Collecting networkx Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed ox/ Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed ox/ Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed ox/ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed ox/ Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed ox/ Could not find a version that satisfies the requirement networkx (from versions: ) No matching distribution found for networkx The command '/bin/sh -c pip install networkx' returned a non-zero code: 1 ``` </br> ### 修改pip源为国内源 ``` RUN pip install networkx -i http://pypi.douban.com/simple --trusted-host pypi.douban.com ``` ### 再执行 ``` root@vm1:/vob/DIBENV# docker build . Sending build context to Docker daemon 1.19GB Step 1/15 : FROM ubuntu:bionic AS DIB-env ---> d27b9ffc5667 ....... ---> Using cache ---> 5cf17f5d5e70 Step 8/15 : RUN pip install --upgrade pip ---> Using cache ---> 12c35687d374 Step 9/15 : RUN pip install networkx -i http://pypi.douban.com/simple --trusted-host pypi.douban.com ---> Running in 82c268720751 Collecting networkx Downloading http://pypi.doubanio.com/packages/f3/f4/7e20ef40b118478191cec0b58c3192f822cace858c19505c7670961b76b2/networkx-2.2.zip (1.7MB) Collecting decorator>=4.3.0 (from networkx) Downloading http://pypi.doubanio.com/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl Building wheels for collected packages: networkx Running setup.py bdist_wheel for networkx: started Running setup.py bdist_wheel for networkx: finished with status 'done' Stored in directory: /root/.cache/pip/wheels/62/82/57/fc7b6a6eea7339f4b1a1728e8e434a0121f9320b9b060a60dc Successfully built networkx Installing collected packages: decorator, networkx Successfully installed decorator-4.4.2 networkx-2.2 ``` </br> ### 常用 pip 国内源备用 阿里云 http://mirrors.aliyun.com/pypi/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ </br> ### 用法 在原来的pip install software 语句后面 加上 -i 和 --trusted-host -i http://pypi.douban.com/simple --trusted-host pypi.douban.com </br> </br>
Pre:
使用docker 封装一个使用diskimage-builder生成镜像的环境
Next:
Go 笔记
0
likes
1247
Weibo
Wechat
Tencent Weibo
QQ Zone
RenRen
Submit
Sign in
to leave a comment.
No Leanote account?
Sign up now.
0
comments
More...
Table of content
No Leanote account? Sign up now.