The Python installer is reporting this error unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xb0 in position 1:ordinal not in range (128)

Source: Internet
Author: User
When Python is installed, the default encoding is ASCII, and when non-ASCII encoding occurs in the program, Python processing often reports such an error unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0x?? In position 1:ordinal No in range (128) There are 2 ways to set Python's default encoding: Method One: Add the following code to the program: Import sys reload (SYS) sys.setdefaultencoding (' UTF8 ') method two: In the Python installation directory under/etc/python2.6 find sitecustomize.py, add the following: # ENCODING=UTF8 import sys reload (SYS) Sys.setdefaultencoding (' UTF8 ') restarts the Python interpreter, then executes the import syssys.getdefaultencoding () to find that the encoding has been set to UTF8, and after multiple reboots, the effect is the same. This is because the system at the time of Python startup, call the file itself, set the system's default encoding, and do not need to manually add each time to solve the code, is a once and for all solution. With the above modifications, TinyOS can generate the docs document normally.

The Python installer is reporting this error unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xb0 in position 1:ordinal not in range (128)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.