PIP install troubleshooting under Windows [How to Solve]


Traceback (most recent call last): File"C:\Python27\Python27\Scripts\pip-script.py", line 9, in<module> load_entry_point('pip==1.4.1','console_scripts', 'pip')() File"C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\__init__
 .py", line 148, in main

return command.main(args[1:], options) File"C:\Python27\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecomm
 and.py", line 169, in main
 text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xb1 inposition 34: ordinal
 not in range(128)

the CMD environment of windows defaults to GBK encoding, and pip defaults to UTF-8 encoding
however, in Linux and MAC, the terminal environment defaults to UTF-8 encoding, so no error will be reported


Create a file sitecustomize.py in Python directory Python 27\lib\site-packages

import sys sys.setdefaultencoding('gbk')

Python will run this file automatically


Similar Posts: