python 安裝pip的時候出現UnicodeEncodeError錯誤

來源:互聯網
上載者:User

標籤:

另外 Python 中一個比較常見的問題是編碼問題,若遇到類似“UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\u6211′ in position 0: ordinal not in range(128)”的問題,可以在 Python 的安裝目錄(預設為C:\Python27)下的 Lib\site-packages 檔案夾中建立一個檔案sitecustomize.py,添加如下代碼並儲存:

import sys
sys.setdefaultencoding(‘gb2312‘)

切記,該檔案會更改 Python 的預設編碼,以後出現類似的問題,可嘗試將代碼中的 gb2312 改為 utf-8 或 ascii ,然後再次嘗試。

http://dblab.xmu.edu.cn/blog/python-machine-learning-package-windows/

---

另外 Windows下安裝gevent

http://blog.csdn.net/ruguokeyi110/article/details/47725545

下載gevent的.whl檔案

首先在這裡http://www.lfd.uci.edu/%7Egohlke/pythonlibs/找到對應作業系統的gevent檔案,我這裡選擇的是gevent?1.0.2?cp27?none?win32.whl這個版本。

安裝pip

先下載get-pip.py這個檔案,是https://bootstrap.pypa.io/get-pip.py,直接另存新檔即可。放到Python的根目錄下,一般是C:\Python27\這個目錄下。
然後在命令列下進入到這個目錄,運行python get-pip.py等待安裝pip。
安裝完畢後,將python的Scripts目錄加入系統的環境變數。

安裝gevent

在cmd視窗,找到此前下載的gevnet.whl路徑。執行pip install gevent?1.0.2?cp27?none?win32.whl即可。

python 安裝pip的時候出現UnicodeEncodeError錯誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.