Centos7 python Chinese "unicodedecodeerror: ' ASCII ' codec can ' t decode byte ..." Workaround

Source: Internet
Author: User

unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xe5 in position 0:ordinal not in range


1. I began to think that I wrote a python problem, but later found that the same code on other computers running normal ...

2. According to the online method of what load (SYS), or add #-*-Coding:utf-8-*-Way, although all know is python2 years of things. But as soon as the disease Touyi. The result is still invalid.

3. Doubts about CentOS7 Lang problem, the result changed also useless ...

4. Suspicion is a python3.4 problem, and an additional python3.6 is installed. Results two version of the wrong place is still exactly the same.


Then, since there is no reasonable explanation of the problem on the Internet, it is directly on the soil method ~ ~ Black Cat White Cat, the first to catch the mouse again.


Important actions are as follows:

cd/usr/lib64/python3.4/encodings/#python3. x should be the same MV ascii.py Ascii.py.bak #这也算给自己留条后路, and so on will find a problem in the future, can return again. CP utf_8.py ascii.py

Directly with utf_8.py replaced that see the Chinese error ascii.py problem fix. If you find any side effects in the future, you can change them back.


The suspected real point of failure should still be on my CentOS7 system, but it's never a simple change to Lang. Those who really know the truth will find out in the future someday.


Before that, I have the same problem with the small partners, you can first with me to use the earth ~:)





This article is from the "Notes" blog, please be sure to keep this source http://ezaze.blog.51cto.com/2184072/1927922

Centos7 python Chinese "unicodedecodeerror: ' ASCII ' codec can ' t decode byte ..." Workaround

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.