payHook / test_dependencies.py
rogerxavier's picture
Upload 22 files
e1ea60b verified
#!/usr/bin/env python3
"""
测试依赖包是否正确安装
"""
def test_imports():
"""测试所有必要的包是否能正确导入"""
try:
import requests
print("✅ requests 导入成功")
except ImportError as e:
print(f"❌ requests 导入失败: {e}")
try:
import aiohttp
print("✅ aiohttp 导入成功")
except ImportError as e:
print(f"❌ aiohttp 导入失败: {e}")
try:
import fastapi
print("✅ fastapi 导入成功")
except ImportError as e:
print(f"❌ fastapi 导入失败: {e}")
try:
import urllib3
print("✅ urllib3 导入成功")
except ImportError as e:
print(f"❌ urllib3 导入失败: {e}")
try:
import tablestore
print("✅ tablestore 导入成功")
except ImportError as e:
print(f"❌ tablestore 导入失败: {e}")
try:
import pydantic
print("✅ pydantic 导入成功")
except ImportError as e:
print(f"❌ pydantic 导入失败: {e}")
try:
import uvicorn
print("✅ uvicorn 导入成功")
except ImportError as e:
print(f"❌ uvicorn 导入失败: {e}")
try:
import pymysql
print("✅ pymysql 导入成功")
except ImportError as e:
print(f"❌ pymysql 导入失败: {e}")
try:
import dotenv
print("✅ python-dotenv 导入成功")
except ImportError as e:
print(f"❌ python-dotenv 导入失败: {e}")
def test_protobuf_conflict():
"""测试 protobuf 版本冲突"""
try:
import protobuf
print(f"✅ protobuf 版本: {protobuf.__version__}")
except ImportError as e:
print(f"❌ protobuf 导入失败: {e}")
if __name__ == "__main__":
print("=== 测试依赖包导入 ===")
test_imports()
print("\n=== 测试 protobuf 版本 ===")
test_protobuf_conflict()
print("\n=== 测试完成 ===")