pip批量下载离线安装包并离线批量安装(windows)

·
编程 架构和环境配置 no tag June 25, 2019

import os

path = 'E:\\_pkgs_'
cmd = 'pip download -d ' + path + ' ' + 'pkg_name' + ' ' + '-i  https://pypi.tuna.tsinghua.edu.cn/simple/'
print(cmd)

with open('requirements.txt', 'r') as f:
    for line in f.readlines():
        result = os.system(cmd.replace('pkg_name', line.strip()))

然后切换到path目录下,执行

pip install --no-index --find-links=E:\\_pkgs_ -r requirements.txt

requirements.txt是包列表。

  • 最近在github上开源的一个项目
  • 受Erlang启发的Python快速排序极简实现
取消回复

说点什么?

© 2021 Self. Using Typecho & Moricolor.