-
Notifications
You must be signed in to change notification settings - Fork 143
/
常见问题及解决方案.html
296 lines (274 loc) · 24.9 KB
/
常见问题及解决方案.html
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<!DOCTYPE HTML>
<html lang="">
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>常见问题及解决方案 · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<link rel="stylesheet" href="接口使用文档/gitbook/style.css">
<link rel="stylesheet" href="接口使用文档/gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
<link rel="stylesheet" href="接口使用文档/gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="接口使用文档/gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="接口使用文档/gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="接口使用文档/gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="接口使用文档/gitbook/images/favicon.ico" type="image/x-icon">
<link rel="prev" href="教程/接收消息.html" />
</head>
<body>
<div class="book">
<div class="book-body" style="left: 0;">
<div class="body-inner">
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h2 id="使用前,请先保证">使用前,请先保证</h2>
<ol>
<li>你的Python环境是:Python36/37/38/39,并且是64位的</li>
<li>你的杀毒软件没有删除libs目录下的dll文件</li>
<li>安装的微信版本正确</li>
</ol>
<h2 id="常见问题及解决方案">常见问题及解决方案</h2>
<p>
<strong>常见问题1:</strong>
</p>
<p>
<img src="接口使用文档/images/常见问题1.png" alt="">
</p>
<ul>
<li>原因1:请检查你的微信版本是否是指定版本</li>
<li>原因2:请检查你的杀毒软件是否把libs文件夹中的dll文件拦截了</li>
<li>解决方案:安装指定版本的微信、把dll文件添加至你杀毒软件的白名单中</li>
</ul>
<p>
<strong>常见问题2:</strong>
</p>
<p>
<img src="接口使用文档/images/常见问题2.png" alt="">
</p>
<ul>
<li>原因:这是因为你的Python环境不是36/37/38/39,或者不是64位的,再或者是没有安装依赖库。</li>
<li>解决方案:
<ul>
<li>使用对应版本的Python环境(必须是64位)</li>
<li>
<span style="color: red">初次使用需要pip安装两个库:</span>
<ul>
<li>pip install requests</li>
<li>pip install pycryptodomex</li>
</ul>
</li>
<li>若还不行,请把其他pyd删除掉(你是Python36。就删除37、38、39的pyd文件,其他版本同理)</li>
</ul>
</li>
</ul>
<p>
<strong>常见问题3:</strong>
</p>
<p>
<img src="接口使用文档/images/常见问题3.png" alt="">
</p>
<ul>
<li>原因:如果遇到这种问题,请检查你的杀毒软件是否把libs目录下的dll文件误删了</li>
<li>解决方案:关闭杀毒软件或者把WeChatApi.dll设置为白名单</li>
</ul>
<p>
<strong>常见问题4:</strong>
</p>
<p>
<img src="接口使用文档/images/常见问题4.png" alt="">
</p>
<ul>
<li>
<p>导致原因1:你的Python环境是32位的,但是你正在使用64位的pyd文件</p>
</li>
<li>
<p>解决方案:使用64位的Python环境运行</p>
</li>
</ul>
<ul>
<li>
<p>导致原因2:你可能误删了pyd文件,然后又把它从回收站恢复回来,导致编码错误</p>
</li>
<li>
<p>解决方案:此时你只能重新pull一遍项目了</p>
</li>
</ul>
<p>
<strong>常见问题5</strong>
</p>
<ul>
<li>我的Python环境没问题、用的也是对应版本的微信,为什么实例化的时候还是报错?</li>
<li>类似这种错误:
<span style="color: red">《ImportError: DLL load failed: 找不到指定的模块》</span>
</li>
</ul>
<p>
<img src="接口使用文档/images/常见问题5.png" alt="">
</p>
<ul>
<li>
<p>原因:包的版本太高也可能会导致实例化失败,主要是《pycryptodomex》这个包</p>
</li>
<li>
<p>解决方案:</p>
<ul>
<li>尝试降低或升高包的版本</li>
<li>
<span style="color: red">以下是我本机环境的包版本,供参考:</span>
<ul>
<li>requests==2.23.0</li>
<li>pycryptodomex==3.9.4</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>
<strong>常见问题6:</strong>
</p>
<p>
<img src="接口使用文档/images/常见问题6.png" alt="">
</p>
<ul>
<li>
<p>原因:</p>
<ul>
<li>有很多小伙伴不太了解pyd文件,在导包时,Pycharm报红,以为这是一个error</li>
</ul>
<p>
<img src="接口使用文档/images/常见问题6-1.png" alt="">
</p>
<ul>
<li>于是他把文件名后缀改为.py</li>
</ul>
</li>
<li>
<p>解决方案:报红为正常现象,请不要随意改动文件后缀</p>
</li>
</ul>
<ul>
<li>
<p>
<span style="color: red">这里说一点:很多小伙伴觉得pyd文件名长的恶心,比如这样:【WeChatPYAPI.cp38-win_amd64.pyd】,其实中间那坨是可以删掉的,给你们的时候留着是为了你们好分辨版本,实际项目中可以改成下图这样:</span>
</p>
<p>
<img src="接口使用文档/images/常见问题6-2.png" alt="">
</p>
</li>
</ul>
<p>
<strong>常见问题7(一启动就崩溃):</strong>
</p>
<p>
<img src="接口使用文档/images/常见问题7.png" alt="">
</p>
<ul>
<li>
<p>原因:没有使用对应微信版本的包</p>
</li>
<li>
<p>解决方案:</p>
<ul>
<li>如果你使用的是社区版
<ul>
<li>安装社区版指定版本的微信</li>
<li>使用社区版的包</li>
</ul>
</li>
<li>如果你使用的是专业版
<ul>
<li>安装专业版指定版本的微信</li>
<li>使用专业版的包</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="其他问题">其他问题</h2>
<ul>
<li>
<p>问题1:很多小伙伴会使用pyinstaller对自己的项目进行打包,但是打包后发现无法正常使用WeChatPYAPI</p>
</li>
<li>
<p>答:如果你使用“-F”打包为单文件,那么记得把libs文件夹载入你的虚拟目录中,如果你打包为多文件,那么直接把libs文件夹拷贝至你的项目目录中</p>
</li>
</ul>
<ul>
<li>
<p>问题2:为什么使用pyinstaller打包时,出现包不存在的问题</p>
</li>
<li>
<p>答:因为pyinstaller打包时,会检测pyd中使用到的包,如果你使用pyinstaller打包,请在你的main文件头部添加以下代码:</p>
</li>
<li>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> json, requests
<span class="hljs-keyword">from</span> http.server <span class="hljs-keyword">import</span> HTTPServer, BaseHTTPRequestHandler
<span class="hljs-keyword">from</span> Cryptodome.Cipher <span class="hljs-keyword">import</span> AES
<span class="hljs-keyword">try</span>:
<span class="hljs-keyword">import</span> xml.etree.cElementTree <span class="hljs-keyword">as</span> ET
<span class="hljs-keyword">except</span> ImportError:
<span class="hljs-keyword">import</span> xml.etree.ElementTree <span class="hljs-keyword">as</span> ET
</code></pre>
</li>
</ul>
<ul>
<li>
<p>问题3:我可以自行指定libs目录路径吗?</p>
</li>
<li>
<p>答:可以,如果你不想在项目中有libs文件夹,在实例化WeChatPYApi的时候,传入参数:libs_dir=你自定义目录的绝对路径。虽然目录可更改,但是!
<strong>WeChatApi.dll</strong>跟
<strong>inject_tool.exe</strong>两个文件必须在同一级目录下:</p>
<p>
<img src="接口使用文档/images/其它问题2.png" alt="">
</p>
</li>
</ul>
<ul>
<li>问题4:如果你使用社区版本时出现了崩溃的问题,很不幸,这个问题在社区版没有得到解决。</li>
</ul>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title">
<span class='search-results-count'></span> results matching "
<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "
<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function () {
gitbook.page.hasChanged({ "page": { "title": "常见问题及解决方案", "level": "1.15", "depth": 1, "previous": { "title": "接收消息", "level": "1.14", "depth": 1, "path": "教程/接收消息.md", "ref": "教程/接收消息.md", "articles": [] }, "dir": "ltr" }, "config": { "gitbook": "*", "theme": "default", "variables": {}, "plugins": ["expandable-chapters"], "pluginsConfig": { "expandable-chapters": {}, "highlight": {}, "search": {}, "lunr": { "maxIndexSize": 1000000, "ignoreSpecialCharacters": false }, "sharing": { "facebook": true, "twitter": true, "google": false, "weibo": false, "instapaper": false, "vk": false, "all": ["facebook", "google", "twitter", "weibo", "instapaper"] }, "fontsettings": { "theme": "white", "family": "sans", "size": 2 }, "theme-default": { "styles": { "website": "styles/website.css", "pdf": "styles/pdf.css", "epub": "styles/epub.css", "mobi": "styles/mobi.css", "ebook": "styles/ebook.css", "print": "styles/print.css" }, "showLevel": false } }, "structure": { "langs": "LANGS.md", "readme": "README.md", "glossary": "GLOSSARY.md", "summary": "SUMMARY.md" }, "pdf": { "pageNumbers": true, "fontSize": 12, "fontFamily": "Arial", "paperSize": "a4", "chapterMark": "pagebreak", "pageBreaksBefore": "/", "margin": { "right": 62, "left": 62, "top": 56, "bottom": 56 } }, "styles": { "website": "styles/website.css", "pdf": "styles/pdf.css", "epub": "styles/epub.css", "mobi": "styles/mobi.css", "ebook": "styles/ebook.css", "print": "styles/print.css" } }, "file": { "path": "常见问题及解决方案.md", "mtime": "2024-06-09T21:43:27.752Z", "type": "markdown" }, "gitbook": { "version": "3.2.3", "time": "2024-06-09T21:54:25.842Z" }, "basePath": ".", "book": { "language": "" } });
});
</script>
</div>
<script src="接口使用文档/gitbook/gitbook.js"></script>
<script src="接口使用文档/gitbook/theme.js"></script>
<script src="接口使用文档/gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
<script src="接口使用文档/gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="接口使用文档/gitbook/gitbook-plugin-search/search.js"></script>
<script src="接口使用文档/gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="接口使用文档/gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="接口使用文档/gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="接口使用文档/gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>