Python3 offline installation package and carry local source
This blog post is mainly used to record various pitfalls encountered by individuals in building python PIP3 local sources, and to record
Ways to build a local source
1.bandsnatch+Apache
这种方式是官方推荐的,它的特点是:
1.支持全量同步,不支持指定软件包同步,同步量巨大,非常耗时,而且openstack仅仅依赖少量的软件包;
2.bandsnatch仅支持与https的源进行同步,不支持http的源同步,只能与官方源同步,不能与国内速度快的源,比如豆瓣的源同步;
3.官方全部的软件包很多,听说到2015年的时候就已经是几百G了,现在预估是10T以上。
所以我这边就直接放弃了,网上也有一篇教程可以参考下,如下:
https://yangfannie.com/1496.html.
2. Use pip2pi+nginx
这个方式可以下载自己需要的包,并且支持国内源,具体操作如下:
1.安装pip3以及pip2pi,具体安装方式如下:
安装pip3可参考下面引用的教程:
安装pip2pi可使用pip直接安装也可下载变异安装,如下指令如下:
sudo pip install pip2pi #使用pip安装
git clone https://github.com/wolever/pip2pi
cd pip2pi
sudo python setup.py install
配置要同步的pypi源,比如以与豆瓣的pypi源同步为例
vim ~/.pip/.pip.conf
[global]index-url = http://pypi.douban.com/simple
pip3 installation reference tutorial .
3. The specific operation of using pip2pi+nginx is as follows:
-
1 Download related packages, here you can use pip3 to download, or use pip2pi to download, the specific command is as follows:
pip3 download -r requ.txt -d ./sitepack -i https://pypi.tuna.tsinghua.edu.cn./simple #这里使用的是清华开源镜像网 #注意这里每个包都只会下载一个版本包,不管你文件里面使用的是大于还是小于,如果不指定版本则下载最新版。
-
2. After the package is downloaded, the folder can be indexed, as follows:
dir2pi ./sitepack #对pypi目录下的所有软件包建立索引,在 sitepack目录下建立一个simple文件夹
-
3. Update the index
多个包: pip2acmeco -r requirements.txt 单个包: pip2acmeco package==1.0.0
-
4. Build a server
可以参考这篇博文:https://blog.csdn.net/weixin_30721077/article/details/99220526
Referenced link
https://yangfannie.com/1496.html .
https://blog.csdn.net/weixin_30721077/article/details/99220526
https://blog.csdn.net/qq_36501722/article/details/82115343