安裝setuptool遇到的問題

執行python ez_setup.py 時遇到
  File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
    ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa4 in position 9: ordinal not in range(128)
Something went wrong during the installation.
See the error message above.
修改 C:\Python27\Lib\mimetypes.py 
  1. if sys.getdefaultencoding() != 'gbk':  
  2.     reload(sys)  
  3.     sys.setdefaultencoding('gbk')  
  4. default_encoding = sys.getdefaultencoding()  

找到default_encoding = sys.getdefaultencoding()在之前加入
        if sys.getdefaultencoding() != 'big5':
            reload(sys)
            sys.setdefaultencoding('big5')
再次執行python ez_setup.py就可以正常安裝了,安裝正確後C:\Python27\Scripts\eazy_install.exe會產生

留言