步驟:
- 『file』-> 『Settings』->『Project Interpreter』
-
點擊左側(cè)導(dǎo)航『Project Interpreter』洼裤,點擊右側(cè)的‘+’號邻辉,即可打開插件安裝窗口腮鞍。
打開插件安裝窗口 -
搜索框內(nèi)搜索我要的插件『xlwt』,找到后移国,點擊安裝『Install Package』
安裝xlwt包 -
安裝報錯,報錯信息『UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 0: ordinal not in range(128)』
安裝報錯 - 報錯原因:pip安裝python包會加載我的用戶目錄迹缀,我的用戶目錄恰好是中文的,ascii不能編碼祝懂。
中文用戶名 - 解決辦法:C盤『用戶』盡量不要動,免得系統(tǒng)出問題砚蓬。** python目錄 D:\Python27Interpreter\Lib\site-packages 建一個文件sitecustomize.py **
內(nèi)容為:
import sys
sys.setdefaultencoding('gb2312')
python會自動運行這個文件矢门。 -
安裝成功
安裝成功