| """ | |
| 确保所有依赖项都已安装 | |
| """ | |
| import os | |
| def ensure_package_exist(): | |
| """ | |
| 确保所有依赖项都已安装 | |
| """ | |
| try: | |
| import initialize | |
| from selenium import webdriver | |
| import type_defs as types | |
| from fake_useragent import UserAgent | |
| except: | |
| print("警告:你似乎还没有安装完全这些依赖项") | |
| op=input("输入y以自动安装,或者输入uv使用uv pip:") | |
| if op == "y": | |
| os.system("pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt") | |
| print("安装完成!") | |
| elif op == "uv": | |
| os.system("uv pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt") | |
| print("安装完成!") | |
| else: | |
| print("缺少必要依赖项") | |
| print("程序无法运行,即将退出") | |
| input("Press Enter to Continue...") | |
| exit() | |