擅长:python、mysql、java
<p>所以,对于那些不懂中文的人,(一个已经删除的答案)建议为文件定义源代码编码。在</p>
<p>如果您仔细阅读错误,PyCharm会告诉您解决此问题所需的一切:</p>
<blockquote>
<p>SyntaxError: Non-UTF-8 code starting with '\x90' in file C:\Users\pli\AppData\Local\Programs\Python\Python35-32\python.exe on line 1, but <strong>no encoding declared; see <a href="http://python.org/dev/peps/pep-0263/" rel="nofollow">http://python.org/dev/peps/pep-0263/</a> for details</strong></p>
</blockquote>
<p>现在,如<a href="https://www.python.org/dev/peps/pep-0263/" rel="nofollow">PEP 0263</a>所述:</p>
<blockquote>
<p>Python will default to ASCII as standard encoding if no other encoding hints are given ... To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file.</p>
</blockquote>
<p>您是否尝试过粘贴一条神奇的注释来口述源代码,例如:</p>
<pre><code># -*- coding: utf-8 -*-
...
</code></pre>
<p>我记得以前遇到过同样的问题,定义源代码编码立即为我解决了这个问题。在</p>