windows执行python文件提示SyntaxError: Non-ASCII character ‘xe9‘ in file 1.py on line 7, but no encoding d(

Posted chen.yu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了windows执行python文件提示SyntaxError: Non-ASCII character ‘xe9‘ in file 1.py on line 7, but no encoding d(相关的知识,希望对你有一定的参考价值。

1、问题

windows环境下执行python文件,提示错误如下

SyntaxError: Non-ASCII character '\\xe9' in file 1.py on line 7, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

2、解决办法

py文件头部加上 

#coding=utf-8 


 

以上是关于windows执行python文件提示SyntaxError: Non-ASCII character ‘xe9‘ in file 1.py on line 7, but no encoding d(的主要内容,如果未能解决你的问题,请参考以下文章

python中提示invalid syntax 总结

syntax error:unexpected end of file

Python在开发程序时提示错误提示“invalid syntax”是什么原因已解决

Pytnon中的SyntaxError: invalid syntax出错?

执行shell脚本报错:syntax error near unexpected token `或syntax error: unexpected end of file

Python IDLE 提示出错 invalid syntax?