一次性安装20个或者更多常用Pyhon第三方库,一个一个安装是不是太不像程序员的风格了。
用下面的代码一次性安装20个常用Python第三方库,并返回安装结果。
输入代码:
import os
ml = {"numpy","matplotlib","pillow","sklearn","requests",\
"jieba","beautifulsoup4","wheel","networkx","sympy",\
"pyinstaller","django","flask","werobot","pyqt5",\
"pandas","pyopengl","pypdf2","docopt","pygame"}
try:
for i in ml:
os.system("pip3 install "+i)
print("安装成功")
except:
print("安装失败")
如果想调整安装的第三方库,修改目录里的库名就可以了。调整完毕就可以让程序自动执行,过一会再来检验运行结果就行了。
_______________END______________
网友评论