Skip to content

Commit 6e30f1f

Browse files
committedSep 8, 2022
新增ImportError问题说明
1 parent e279b6e commit 6e30f1f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed
 

‎docs/FAQ.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## WeChatVersionNotMatchError异常
1+
## 1. WeChatVersionNotMatchError异常
22
如果出现`ntchat.exception.WeChatVersionNotMatchError`异常, 请确认是否安装github上指定的微信版本,如果确认已经安装,还是报错,可以在代码中添加以下代码,跳过微信版本检测
33
```python
44
import ntchat
@@ -23,8 +23,13 @@ Windows Registry Editor Version 5.00
2323
"InstallPath"="C:\Program Files (x86)\Tencent\WeChat"
2424
```
2525

26+
## 2. `ImportError: cannot import name 'wcprobe' from ''ntwork.wc'`
2627

27-
## 如何多开
28+
出现在这个错误的原因是因为你在github下载的源码目录中运行程序,因为wcprobe是根据python版本自动编译生成的,所以源码目录中没有这个文件.
29+
30+
你需要将要`运行的例子文件移动到非源码目录下`,再去运行或打包
31+
32+
## 3. 如何多开
2833

2934
新建多个ntchat.WeChat实例,然后调用open方法:
3035
```python
@@ -37,7 +42,7 @@ for i in range(3):
3742
```
3843
更完善的多实例管理查看[fastapi_example例子](./fastapi_example)
3944

40-
## 如何监听输出所有的消息
45+
## 4. 如何监听输出所有的消息
4146
```python
4247
# 注册监听所有消息回调
4348
@wechat.msg_register(ntchat.MT_ALL)
@@ -47,7 +52,7 @@ def on_recv_text_msg(wechat_instance: ntchat.WeChat, message):
4752
```
4853
完全例子查看[examples/msg_register_all.py](../examples/msg_register_all.py)
4954

50-
## 如何关闭NtChat的日志
55+
## 5. 如何关闭NtChat的日志
5156

5257
`os.environ['NTCHAT_LOG'] = "ERROR"` 要在`import ntchat`前执行
5358
```python
@@ -60,7 +65,7 @@ os.environ['NTCHAT_LOG'] = "ERROR"
6065
import ntchat
6166
```
6267

63-
## 如何正常的关闭Cmd窗口
68+
## 6. 如何正常的关闭Cmd窗口
6469

6570
先使用`pip install pywin32` 安装pywin32模块, 然后在代码中添加以下代码, 完整例子查看[examples/cmd_close_event.py](../examples/cmd_close_event.py)
6671
```python
@@ -78,7 +83,7 @@ win32api.SetConsoleCtrlHandler(on_exit, True)
7883
```
7984

8085

81-
## pyinstaller打包exe
86+
## 7. pyinstaller打包exe
8287
使用pyinstaller打包NtChat项目,需要添加`--collect-data=ntchat`选项
8388

8489
打包成单个exe程序

0 commit comments

Comments
 (0)
Please sign in to comment.