Python in Eclipse Chinese error resolution SYNTAXERROR:NON-ASCII character

Source: Internet
Author: User

The reason is that in the simplified Chinese environment of the Win7 system, the Chinese encoding format used by default is the GBK format, and Eclipse's default encoding format is the encoding format of the system in which it is used. Therefore, you need to modify eclipse in the default encoding format.

Steps Open Eclipse,windows-Preferences ...

Navigate to General, Workspace on the left, click Other in the text file encoding on the right, select UTF-8, and click OK.

Step 2 Windows-Preferences ...

Navigate to content Types on the left, click Text in the content Types on the right, select Python File, enter UTF-8 in the default encoding below, and click Update. then click OK.

After modifying the default encoding format for Eclipse workspaces and Python files, in a Python module with Chinese encoding, the first line of the file declares the encoding format of the file, #-*-Coding:utf-8-*-can be developed and debugged with the Chinese Python program.

Python in Eclipse Chinese error resolution SYNTAXERROR:NON-ASCII character

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.