Python 第三方库自动安装脚本

需求:批量安装第三方库需要人工干预,能否自动安装?

现假设我们要安装以下库
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

#BatchInstall.py
import os
libs = {
    
    "numpy","matplotlib","pillow","sklearn","requests",\
"jieba","beautifulsoup4","wheel","networkx","sympy",\
"pyinstaller","django","flask","werobot","pyqt5",\
"pandas","pyopengl","pypdf2","docopt","pygame"}

try:
    for lib in libs:
        os.system("pip install" + lib)
    print("Successful")
except:
    print("Failed Somehow")

出处:北理工python慕课

猜你喜欢

转载自blog.csdn.net/weixin_44997802/article/details/108232556
今日推荐