Python3.7使用pip install xxxx报错:UnicodeDecodeError: 'gbk' codec can't decode byte

今天需要使用python开发Storm,需要使用命令pip安装pyleus,但出现了错误,能力有限解决了好久。。。。。。

错误如下:

C:\Users\sxgjhsdn>pip install pyleus
Collecting pyleus
  Using cached https://files.pythonhosted.org/packages/39/27/516fb9ee0ebb3e607620275d44af6ebf79fab3482b09c8605530a98819c8/pyleus-0.3.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "", line 1, in 
      File "C:\Users\sxgjhsdn\AppData\Local\Temp\pip-install-0r5oj6na\pyleus\setup.py", line 81, in 
        long_description=readme(),
      File "C:\Users\sxgjhsdn\AppData\Local\Temp\pip-install-0r5oj6na\pyleus\setup.py", line 65, in readme
        return f.read()
    UnicodeDecodeError: 'gbk' codec can't decode byte 0x99 in position 820: illegal multibyte sequence

这个时候我的pip版本是最新的。

盖因是win10编码的问题!

话不多说,解决方法如下:

使用命令:pip download pyleus下载好需要的tar包,进入tar包:

Python3.7使用pip install xxxx报错:UnicodeDecodeError: 'gbk' codec can't decode byte_第1张图片

编辑(报错行是65):

def readme():
    #在open的参数中加入mode='r'和encoding='UTF-8'参数
    with open("README.rst", mode='r',encoding='UTF-8') as f:
        #报错行
        return f.read()

在cmd中执行:pip install pyleus-0.3.0.tar.gz 。

Success!

你可能感兴趣的:(Python)