#BatchInstall.py
import os
libs = {“requests”,
“sympy”,\
}
try:
for lib in libs:
os.system("pip install "+lib)
print(“Successful”)
except:
print(“Failed Somehow”)
中install后面的空格会影响到cmd5能否正确的安装
本文介绍了一个使用Python编写的脚本,该脚本可以批量安装指定的Python库,如requests和sympy。通过调用系统的pip命令,脚本能够自动化完成库的安装过程。然而,脚本中存在可能导致安装失败的问题,例如install关键字后的空格。
#BatchInstall.py
import os
libs = {“requests”,
“sympy”,\
}
try:
for lib in libs:
os.system("pip install "+lib)
print(“Successful”)
except:
print(“Failed Somehow”)
中install后面的空格会影响到cmd5能否正确的安装
1169
416

被折叠的 条评论
为什么被折叠?