Spaces:
Running
Running
File size: 2,011 Bytes
e1ea60b |
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
#!/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=== 测试完成 ===") |