天天看点

Learning Python 027 解决错误:SyntaxError: Non-UTF-8 Code Starting With '\xc8' in File xxxx.py

原博文链接:http://www.aobosir.com/blog/2016/12/01/SyntaxError-Non-UTF-8-code-starting-with-in-file/

  • 使用的电脑系统:Windows 10 64位
  • 使用的开发集成环境:PyCharm 2016.1.4
  • 使用的Python的版本:python2.7.10 或者 python 3.5.0
本博文对Python2和Python3都适用。

出现这个错误,是因为

xxxx.py

文件里面有中文字符。

解决办法:在文件第一行,加上下面的代码:

请访问:http://www.aobosir.com/