File size: 978 Bytes
e28c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""

确保所有依赖项都已安装

"""
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()