最近學(xué)習(xí)python愈污,在安裝scrapy時(shí),出現(xiàn)一大堆 的錯(cuò)誤地粪,總結(jié)如下:
1.UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 4: ordinal not in range
? 解決方案:找到C/Python27/lib/mimetypes.py
? 在大概250行的位置?添加如下代碼:if ?sys.getdefaultencoding() !='gbk':
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reload(sys)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sys.setdefaultencoding('gbk')
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? default_encoding = sys.getdefaultencoding()
2.出錯(cuò)cl.exe failed with exit status2解決方法(一般是在安裝lxml)
? ? 解決方案:set STATICBUILD=true && pip install lxml
3.Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat 解決辦法
? 解決方案:下載? Microsoft Visual C++ Compiler for Python 2.7首量, 安裝一下問題解決
? ?下載鏈接:
? ?http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266
4 No module named cryptography.hazmat.bindings.openssl.binding
? ? 解決方案:python -m pip install --upgrade pip
? ? ? ? ? ? ? ? ? ? ?and
? ? ? ? ? ? ? ? ? ? ?pip2 install cryptography
5.? 需要安裝? pip install pyOpenSSL cryptography