centso7系统、已有python环境,能连接外网和内网
yum install -y epel-release
yum install -y python-pip
pip install pip2pi
mkdir -p /home/pip_source
单个包同步:
pip2tgz /home/pip_source pytest
批量同步:
pip2tgz /home/pip_source -r requirements.txt
查看同步的包:
ls -l /home/pip_source/
dir2pi /home/pip_source/
# pip_source
server {
listen 8082;
server_name localhost;
charset utf-8,gbk;
location / {
root /home/pip_source;
autoindex on;
autoindex_exact_size off; #显示文件的大小
autoindex_localtime on; #显示文件时间
}
access_log logs/pip.log;
}
service nginx restart
访问地址:ip:8082
内网测试:pip3 install --index-url=http://ip:8082/simple/ --trusted-host=ip django==3.2.0
C盘-->用户-->admin(自己的账户名)
新建pip文件夹,pip文件夹下新建pip.ini文件
[global]
index-url = http://192.168.16.101:8082/simple
[install]
trusted-host = 192.168.16.101
pip3 install pytest