import os
def install_packages():
libs = ["numpy", "matplotlib", "pillow", "sklearn", "scipy", "requests", "uvicorn", "pyspider",
"beautifulsoup4", "wheel", "networkx", "sympy", "pyinstaller", "django",
"flask", "fastapi", "pyqt5", "pandas", "pyopengl", "pypdf2", "docopt", "pygame"
]
torch_libs = ["torch==1.9.0+cu102", "torchvision==0.10.0+cu102", "torchaudio===0.9.0"
]
lib = None
try:
for lib in libs:
os.system("pip install " + lib + " -i https://pypi.tuna.tsinghua.edu.cn/simple/")
print("安装成功:\t" + str(lib))
except Exception as err:
print("安装失败\t" + str(lib) + str(err))
try:
for lib in torch_libs:
os.system("pip install " + lib + " -f https://download.pytorch.org/whl/torch_stable.html")
print("安装成功:\t" + str(lib))
except Exception as err:
print("安装失败\t" + str(lib) + str(err))
if __name__ == '__main__':
install_packages()
|