搭建本地pip源(windows)
1、bandersnatch安装:
pip install bandersnatch
2、生成bandersnatch.conf文件:并创建软件包存放目录。
bandersnatch -c 路径bandersnatch.conf mirror
3、修改bandersnatch.conf文件,只修改如下位置:
[mirror]
; The directory where the mirror data will be stored.
directory = 本地存储软件包的目录,web目录的上级目录
; master = https://testpypi.python.org
; scheme for PyPI server MUST be https
master = https://pypi.python.org
4、配置nginx:
server {
listen *:80;
server_name localhost;
root F:\\python_package\\web;
autoindex on;
charset utf-8;
}
5、本地配置自建的pip源:
windows目录:C:\Users\用户\AppData\Roaming\pip\pip.ini
[global]
timeout = 6000
index-url = http://ip+端口
trusted = ip+端口
linux下配置:
vim ~/.pip/pip.conf
[global]
timeout = 6000
index-url = http://{yourIP}/simple
trusted-host = {yourIP}
6、测试,由于是本地自建pip源没有使用https,安装命令如下:
pip install 软件名 --truste-host 本地pip源的IP地址

浙公网安备 33010602011771号