天天看點

使用wxpy這個基于python實作的微信工具庫的一些常見問題

使用如下的指令行安裝:

pip install wxpy

Collecting wxpy

Downloading

https://files.pythonhosted.org/packages/6b/ac/8f c4561551489f36/wxpy-0.3.9.8.tar.gz (45kB)

100% | 51kB 98kB/s                  

Collecting itchat==1.2.32 (from wxpy)

https://files.pythonhosted.org/packages/61/6d/49

3fec62ed7bb343/itchat-1.2.32-py2.py3-none-any.whl

Requirement already satisfied: requests in c:myapppy20180816

Requirement already satisfied: future in c:myapppy20180816l

om wxpy) (0.16.0)

Collecting pyqrcode (from itchat==1.2.32->wxpy)

https://files.pythonhosted.org/packages/37/61/f0

884ac68d979316/PyQRCode-1.2.1.tar.gz

Collecting pypng (from itchat==1.2.32->wxpy)

https://files.pythonhosted.org/packages/bc/fb/f7

017663467f5147/pypng-0.0.20.tar.gz (649kB)

Requirement already satisfied: certifi>=2017.4.17 in c:myapp\

wxpy) (2018.8.13)

Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:mya

ts->wxpy) (3.0.4)

Requirement already satisfied: urllib3<1.24,>=1.21.1 in c:mya

ts->wxpy) (1.23)

在python檔案wechat.py裡使用這個庫的時候,如果遇到如下的錯誤消息:ModuleNotFoundError: No module named PIL

解決方法是安裝pillow這個庫:

pip install pillow

如果遇到下面這個逾時的錯誤:

Retrying (Retry(total-1, connect=None, read=None, redirect=None, status-None)) aftery 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out./simple/pillow/

可以使用國内鏡像代替:

因為wxpy這個庫背後其實使用的是微信網頁版的功能,是以如果你的python程式在使用wxpy不能正常工作時,先檢查你的微信賬号是否能夠成功登入微信網頁版,如果遇到下列這種提示,說明你的微信賬号無法使用wxpy庫。

本文來自雲栖社群合作夥伴“汪子熙”,了解相關資訊可以關注微信公衆号"汪子熙"。