【Python小白学习】第三方库自动安装脚本

要安装较多的第三方库时,编写一个程序使其完成自动安装。

程序中的第三方库名可改变。

#BatchInstall.py

import os

libs = {"numpy", "mathplotlib", "pillow", "sklearn", "requests", \
        "jieba", "beautifulsoup4", "networkx", "werobot", "pypdf2", \
        "pandas", "pygame"}
try:
    for lib in libs:
        os.system("pip install" + lib)
    print("Successful")
except:
    print("Failed Somehow")

 

你可能感兴趣的:(Python)