python3.6安裝Scrapy出現以下錯誤怎麼解決?

Running setup.py install for pycparser ... done
Running setup.py install for zope.interface ... error
Exception:
Traceback (most recent call last):
File "c:users46782appdatalocalprogramspythonpython36libsite-packagespipcompat\__init__.py", line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: utf-8 codec cant decode byte 0xa1 in position 72: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:users46782appdatalocalprogramspythonpython36libsite-packagespipasecommand.py", line 215, in main
status = self.run(options, args)
File "c:users46782appdatalocalprogramspythonpython36libsite-packagespipcommandsinstall.py", line 342, in run
prefix=options.prefix_path,
File "c:users46782appdatalocalprogramspythonpython36libsite-packagespip
eq
eq_set.py", line 784, in install
**kwargs
File "c:users46782appdatalocalprogramspythonpython36libsite-packagespip
eq
eq_install.py", line 878, in install
spinner=spinner,
File "c:users46782appdatalocalprogramspythonpython36libsite-packagespiputils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "c:users46782appdatalocalprogramspythonpython36libsite-packagespipcompat\__init__.py", line 75, in console_to_str
return s.decode(utf_8)
UnicodeDecodeError: utf-8 codec cant decode byte 0xa1 in position 72: invalid start byte

使用的是pip3 install scrapy 命令。


應該是在windows系統下吧,估計返回的錯誤值有中文,以UTF8解碼不出來,可以嘗試臨時修改出錯處的代碼,將 return s.decode(utf_8) 改為 return s.decode(cp936) 試試。安裝完再改回去


打開c:program filespython36libsite-packagespipcompat\__init__.py約75行
return s.decode(utf_8) 改為return s.decode(cp936)


推薦閱讀:

excel中想實現使用Python代替VBA,請問應該怎麼做?
關於Django,我想推薦這樣一本書給你
PyQt5系列教程(1):我與PyQt5有個約會
python爬蟲實習?

TAG:Python | 爬蟲計算機網路 | Python框架 | Python入門 | scrapy |