forked from mrsanshui/WeChatPYAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
常见问题及解决方案.html
225 lines (203 loc) · 18.8 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
<!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</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</li>
<li>解决方案:使用对应版本的Python环境即可</li>
</ul>
<p>
<strong>常见问题3:</strong>
</p>
<p>
<img src="接口使用文档/images/问题3.png" alt="">
</p>
<ul>
<li>原因:如果遇到这种问题,请检查你的杀毒软件是否把libs目录下的dll文件误删了</li>
<li>解决方案:关闭杀毒软件或者把WeChatPYAPI.dll设置为白名单</li>
</ul>
<p>
<strong>常见问题4:</strong>
</p>
<p>
<img src="接口使用文档/images/问题4.png" alt="">
</p>
<ul>
<li>
<p>导致原因1:你的Python环境是64位的,但是你正在使用32位的pyd文件,反之同理</p>
</li>
<li>
<p>解决方案:源码中已提供32位跟64位的pyd文件,选择对应的pyd文件进行导包即可</p>
</li>
</ul>
<ul>
<li>
<p>导致原因2:你可能误删了pyd文件,然后又把它从回收站恢复回来,导致编码错误</p>
</li>
<li>
<p>解决方案:此时你只能重新pull一遍项目了</p>
</li>
</ul>
<p>
<strong>常见问题5:</strong>
</p>
<p>
<img src="接口使用文档/images/问题5.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>
<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, win32con, win32api, psutil
<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>WeChatPYAPI.dll</strong>跟
<strong>multi_open.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.11", "depth": 1, "previous": { "title": "消息类型", "level": "1.10", "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": "2021-12-18T11:54:48.504Z", "type": "markdown" }, "gitbook": { "version": "3.2.3", "time": "2021-12-18T12:00:53.809Z" }, "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>