生成已安装包清单python
pip freeze >requirements.txt
如本地保留了以前下载的各依赖包,直接将各whl/tar/zip包保存到某个文件夹下,如./packageslinux
如本地未保留以前下载的各依赖包whl/tar/zip包,则须要用下面的命令从网络下载到./packages网络
pip download -r requirements.txt -d ./packages
指定参数下载架构
pip download \ --only-binary=:all: \ # 只下载二进制package(即wheel或egg) --platform linux_x86_64 \ # 说明是linux 64位架构 --python-version 27 \ # Python 2.7 --implementation cp \ # cpython,通常都是这个 --abi cp27mu -r requirements.txt -d ./packages
将 packages
文件夹和 requirements.txt
拷贝至离线机器上某个目录下,ui
packages
文件夹 和 requirements.txt
放在同目录下,命令窗口进入D:,输入如下命令,依赖包便可批量安装完成url
离线安装依赖包code
pip install --no-index --find-links=./packages -r requirements.txt
pip download -h 查看帮助信息orm
Usage: pip download [options] <requirement specifier> [package-index-options] ... pip download [options] -r <requirements file> [package-index-options] ... pip download [options] [-e] <vcs project url> ... pip download [options] [-e] <local project path> ... pip download [options] <archive url/path> ...