Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
453 views
in Technique[技术] by (71.8m points)

Python 2.7 : LookupError: unknown encoding: cp65001


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The error means that Unicode characters that your script are trying to print can't be represented using the current console character encoding.

Also try to run set PYTHONIOENCODING=UTF-8 after execute pip --version without reloading terminal if everything going well add PYTHONIOENCODING as env variable with value UTF-8. See How to set the path and environment variables in Windows article to get info how to add Windows variable.

NOTE: For PowerShell use $env:PYTHONIOENCODING = "UTF-8"

Also you can try to install win-unicode-console with pip:

pip install win-unicode-console

Then reload your terminal and try to execute pip --version

However you can follow suggestions from Windows cmd encoding change causes Python crash answer because you have same problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...