pip install 出現報UnicodeEncodeError錯誤的問題

pip install 安裝selenium時報錯:UnicodeEncodeError: 'ascii' codec can't encode character u'\u258d' in position 8: illegal multibyte sequence

解決:

決辦法是:
python目錄 Python27\Lib\site-packages 建一個文件sitecustomize.py
內容寫:
import sys
sys.setdefaultencoding('utf-8')
python會自動運行這個文件。


參考:http://www.v2ex.com/t/90659

原文:

原因是pip安裝python包會加載我的用戶目錄,我的用戶目錄恰好是中文的,ascii不能編碼。解決辦法是:
python目錄 Python27\Lib\site-packages 建一個文件sitecustomize.py
內容寫:
import sys
sys.setdefaultencoding('gb2312')
python會自動運行這個文件。


雖然我看了我的用戶目錄不是中文,但用這個方法也解決了,感謝!


參考:

安裝python-selenium環境及遇到問題解決    http://www.cnblogs.com/echo-test/p/5145889.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章