Cannot install the package by pip due to some encoding error
See original GitHub issueWhen I try to install the package via pip command, it generates the following error message:
Collecting pygetwindow (from pyautogui) Downloading https://files.pythonhosted.org/packages/f1/54/740939161eb3471e8f775ce9b0fcac0e54c36bf63501e51f2cd7158f587d/PyGetWindow-0.0.3.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File “<string>”, line 1, in <module> File “C:\Users******\AppData\Local\Temp\pip-install-wflouosi\pygetwindow\setup.py”, line 11, in <module> long_description = fh.read() UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa2 in position 905: illegal multibyte sequence
So I tried to modify the setup.py and change the line 11:
Original:
with open("README.md", "r") as fh: long_description = fh.read()
New:
with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read()
It looks like this change can bypass the issue,
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:10
Top GitHub Comments
因为要安装pyautogui,结果要先安装依赖PyGetWindow,然后pip install PyGetWindow报错。 UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa2 in position 905: illegal multibyte sequence 我下载源码修改setup.py,将with open(“README.md”, “r”) 修改成 with open(“README.md”, “r”, encoding=“utf-8”)。 使用wheel进行安装即可。 安装命令: python setup.py bdist_wheel pip install dist/*
我在32位python下用此方法安装pygetwindow版本0.04不行,0.03版本可以