安装LunarSolarConverter第三方库提示:ERROR: Command errored out with exit status 1: python setup.py egg_info Check th e logs for full command output.

在安装LunarSolarConverter第三方库时提示:

      File "<string>", line 1, in <module>
      File "C:\Users\Administrator\AppData\Local\Temp\pip-install-wr4z978d\Lunar
SolarConverter\setup.py", line 15, in <module>
        long_description = f.read()
    UnicodeDecodeError: gbk codec cant decode byte 0xac in position 65: illeg
al multibyte sequence
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check th
e logs for full command output.

 根据提示信息,应该是文件读取中涉及到了中文

下载了LunarSolarConverter-1.1.0.tar.gz到本地并解压,查看其中的setup.py文件,其中14,15行:

with open(README.rst) as f:
    long_description = f.read()

问题应该出在了14行 open 这个函数,作者应该在其后增加 encoding=UTF-8 ,确保数据读取无误。

既然定位到了问题,就修改验证下吧。修改后的代码:

with open(README.rst, encoding=UTF-8) as f:
    long_description = f.read()

因为修改了文件内容,所以我们只好进行本地化安装,代码: python setup.py install 

运行结果:

Installed f:\python38\lib\site-packages\lunarsolarconverter-1.1.0-py3.8.egg
Processing dependencies for LunarSolarConverter==1.1.0
Finished processing dependencies for LunarSolarConverter==1.1.0

安装成功,收工。

==========

续:

经过看作者在GitHub上的项目,作者已经发现并修改了这个bug,但是在pypi上并未更新。故,这篇文章先留着。

文章来自:https://www.cnblogs.com/M-write/p/12319207.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3