-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_install.py
More file actions
73 lines (63 loc) · 1.93 KB
/
test_install.py
File metadata and controls
73 lines (63 loc) · 1.93 KB
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""验证 wxauto 安装"""
import sys
import traceback
print("=" * 60)
print("wxauto 安装验证")
print("=" * 60)
# 步骤0: 移除当前目录,避免干扰
print("\n步骤0: 移除当前目录避免导入干扰...")
current_dir = sys.path[0]
print(f" 移除路径: {current_dir}")
sys.path.pop(0)
print(f" 新的首个路径: {sys.path[0]}")
# 步骤1: 检查 wxauto 模块
print("\n步骤1: 导入 wxauto 模块...")
try:
import wxauto
print(f"✅ wxauto 模块导入成功")
print(f" 位置: {wxauto.__file__}")
except Exception as e:
print(f"❌ wxauto 模块导入失败: {e}")
traceback.print_exc()
sys.exit(1)
# 步骤2: 检查模块内容
print("\n步骤2: 检查 wxauto 模块导出...")
exports = dir(wxauto)
print(f" 导出的内容: {[x for x in exports if not x.startswith('_')]}")
# 步骤3: 尝试导入 WeChat
print("\n步骤3: 导入 WeChat 类...")
try:
from wxauto import WeChat
print(f"✅ WeChat 类导入成功")
except Exception as e:
print(f"❌ WeChat 类导入失败: {e}")
traceback.print_exc()
# 步骤4: 尝试导入 WxParam
print("\n步骤4: 导入 WxParam 类...")
try:
from wxauto import WxParam
print(f"✅ WxParam 类导入成功")
except Exception as e:
print(f"❌ WxParam 类导入失败: {e}")
traceback.print_exc()
# 步骤5: 最终结果
print("\n" + "=" * 60)
try:
from wxauto import WeChat, WxParam
print("🎉 所有依赖安装完成!")
# 尝试获取版本号
if hasattr(wxauto, '__version__'):
print(f"wxauto 版本: {wxauto.__version__}")
else:
# 从 pyproject.toml 读取
import os
wxauto_dir = os.path.dirname(wxauto.__file__)
print(f"wxauto 位置: {wxauto_dir}")
print(f"已安装为开发模式(editable)")
print("=" * 60)
except Exception as e:
print(f"❌ 最终验证失败")
print("=" * 60)
sys.exit(1)