错误记录PyCharm 运行 Python 程序报错 ( SyntaxError: Non-ASCII character ‘xe5‘ in file x.py on line 1, but )(代码
Posted 韩曙亮
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误记录PyCharm 运行 Python 程序报错 ( SyntaxError: Non-ASCII character ‘xe5‘ in file x.py on line 1, but )(代码相关的知识,希望对你有一定的参考价值。
一、报错信息
Y:\\002_WorkSpace\\PycharmProjects\\APK\\venv\\Scripts\\python.exe Y:/002_WorkSpace/PycharmProjects/APK/main.py
File "Y:/002_WorkSpace/PycharmProjects/APK/main.py", line 1
SyntaxError: Non-ASCII character '\\xe5' in file Y:/002_WorkSpace/PycharmProjects/APK/main.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Process finished with exit code 1
二、解决方案
在代码第一行添加 如下内容 :
# coding=utf-8
添加了 # coding=utf-8
后 , Python 程序可运行 ;
以上是关于错误记录PyCharm 运行 Python 程序报错 ( SyntaxError: Non-ASCII character ‘xe5‘ in file x.py on line 1, but )(代码的主要内容,如果未能解决你的问题,请参考以下文章
错误记录PyCharm 运行 Python 程序报错 ( UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xe5 in positio )(代
错误记录PyCharm 运行 Python 程序报错 ( PEP 8: E402 module level import not at top of file )
错误记录PyCharm 运行 Python 程序报错 ( PEP 8: E402 module level import not at top of file )
错误记录PyCharm 运行 Python 程序报错 ( PEP 8: E305 expected 2 blank lines after class or function definiti )(代
错误记录PyCharm 运行 Python 程序报错 ( SyntaxError: Non-ASCII character ‘xe5‘ in file x.py on line 1, but )(代码