批量安装 requirements.txt 中的库,并忽略阻塞的路

import subprocess

# 定义要安装的库的 requirements 文件路径
requirements_file = "requirements.txt"

# 使用 subprocess 执行 pip install 命令并加上 &
cmd = f"pip install -r {requirements_file} &"

# 执行命令
subprocess.call(cmd, shell=True)

posted @ 2023-09-12 14:36  hello_tree  阅读(118)  评论(0)    收藏  举报