Error:
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)
Reason:
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
Solution:
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:
- [Solved] Pyinstaller package Error: AttributeError: ‘str’ object has no attribute ‘decode’
- UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-1:
- [Solved] Python: third-party library fire Install Error
- [Solved] pip install ipython error: ‘ImportError: No module named shutil_get_terminal_size’
- [Solved] Exception: Jupyter command `jupyter-notbook` not found.
- No module named ‘pkg_resources.extern’ [How to Solve]
- [Solved] Captcha Library Error: “OSError: cannot open resource”
- Install CDH6.2 agent error [How to Solve]
- python3 are installed through pip on Win 10, Unicode decodeerror: ‘UTF-8’ codec can’t decode byte
- [Solved] ModuleNotFoundError: No module named’usysconfigdata u x86 64-u-gnu’