1. 升级pip
sudo python3 -m pip install --upgrade pip
2. 升级setuptools
sudo python3 -m pip install --upgrade setuptools
3. 安装pipreqs
pip install pipreqs
4. 生成requirements.txt
pipreqs ./ --encoding=utf-8
5. 下载离线包
pip download -d package -i https://pypi.douban.com/simple -r requirements.txt
6. 安装离线包
pip install --no-index --find-links=./package -r requirements.txt
7.补充
pip download -d package <package_name> -i https://pypi.douban.com/simple
pip download -d package -r requirements.txt -i https://pypi.douban.com/simple
pip install --no-index --find-links=./package package_name
pip install --no-index --find-links=./package -r requirements.txt