python requirements.txt批量下载安装离线

有些情况下我们需要下载N个第三方包,或者下载的包依赖其它包,一个个下载非常浪费时间。这时我们可以通过如下两种方式的命令批量下载。
方式1

pip download -d /tmp/packagesdir <packagename>
方式2

pip download -d /tmp/packagesdir -r requirements.txt
其中requirements.txt是我们需要下载的包清单,例如

jinja2>=2.8
future
lml>=0.0.2
jupyter-echarts-pypkg>=0.1.1
pyecharts-javascripthon
第三方包下载完毕后,我们通过如下命令进行安装
方式1

pip install --no-index --ignore-installed --find-links=/tmp/packagesdir <packagename>
方式2

pip install --no-index --ignore-installed --find-links=/tmp/packagesdir -r requirements.txt

  

原文地址:https://www.cnblogs.com/SunshineKimi/p/11181761.html