[Python]pip install offline 如何离线pip安装包

痛点:目标机器无法连接公网,但是能使用rz、sz传输文件

思路:在能上网的机器是使用pip下载相关依赖包,然后传输至目标机器,进行安装

0. Install pip: http://pip-cn.readthedocs.io/en/latest/installing.html

1. down load from other online pc
refer to https://stackoverflow.com/questions/11091623/python-packages-offline-installation

#pip download -r requirements.txt

2. rz/sz to offline pc

3. prepare requirements.txt and then install
[root@A04-R08]# cat py_env/requirements.txt
pytest==3.2.1


# pip install -r py_env/requirements.txt --no-index --find-links file:py_env

原文地址:https://www.cnblogs.com/carol2000/p/7463153.html