Win下安裝pylint報錯UnicodeDecodeError的解決方案
在windows操作系統下安裝pylint時出現報錯,其報錯內容摘錄如下:
Exception:Traceback (most recent call last): File "c:python27libsite-packagespipasecommand.py", line 215, in main status = self.run(options, args) File "c:python27libsite-packagespipcommandsinstall.py", line 324, in run requirement_set.prepare_files(finder) File "c:python27libsite-packagespip
eq
eq_set.py", line 380, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "c:python27libsite-packagespip
eq
eq_set.py", line 620, in _prepare_file session=self.session, hashes=hashes) File "c:python27libsite-packagespipdownload.py", line 821, in unpack_url hashes=hashes File "c:python27libsite-packagespipdownload.py", line 659, in unpack_http_url hashes) File "c:python27libsite-packagespipdownload.py", line 880, in _download_http_url file_path = os.path.join(temp_dir, filename) File "c:python27lib
tpath.py", line 85, in join result_path = result_path + p_pathUnicodeDecodeError: ascii codec cant decode byte 0xb7 in position 7: ordinal not in range(128)
解決方案:
修改mimetypes.py文件,路徑位於python的安裝路徑下的Libmimetypes.py文件。在import下添加如下幾行:
if sys.getdefaultencoding() != gbk: reload(sys) sys.setdefaultencoding(gbk)
修改截圖如下:
然後就可以繼續愉快的安裝pylint了。
推薦閱讀:
※【Python3網路爬蟲開發實戰】 1.3.1-lxml的安裝
※Python筆記 · 一個多線程知乎用戶爬蟲的實現
※python Web 運維 爬蟲.....一條龍學習視頻教程
※如何在Windows下安裝Scrapy
※關於Excel表格如何處理|一點心得
TAG:Python |