Running setup.py install for Twisted ... error 解决办法

安装报错提示

安装pip install Scrapy 报错提示 Running setup.py install for Twisted ... error ,具体内容:

Exception:
Traceback (most recent call last):
  File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\sit
e-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 2: invalid
continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\sit
e-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\sit
e-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\sit
e-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\sit
e-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\sit
e-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\sit
e-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 2: invalid
continuation byte

解决办法

修改文件 c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\pip\compat\__init__.py 第75行,return s.decode('utf_8') 改为 return s.decode('gbk') ,再次安装pip install Scrapy, 安装成功后还原修改,问题解决。

Requirement already satisfied: pycparser in c:\users\administrator\appdata\local
\programs\python\python36-32\lib\site-packages (from cffi>=1.7; platform_python_
implementation != "PyPy"->cryptography>=2.2.1->pyOpenSSL->Scrapy)
Building wheels for collected packages: Twisted
  Running setup.py bdist_wheel for Twisted ... done
  Stored in directory: C:\Users\Administrator\AppData\Local\pip\Cache\wheels\b3\
76\f7\85353c829c0881e74b5366ce0ed59042b098bb4903e2da8828
Successfully built Twisted
Installing collected packages: Twisted, Scrapy
Successfully installed Scrapy-1.5.0 Twisted-18.4.0

你可能感兴趣的:(Running setup.py install for Twisted ... error 解决办法)