Pycharm报错 : SyntaxError: Non-ASCII character ' but no encoding declared;

 

File "D:/03 ��ѧ/2023�괺��Python/0310/����ѧ�ź������Ƚ�v3--��Ѷ���鿼��ר��--12��.py", line 1
SyntaxError: Non-ASCII character '\xe6' in file D:/03 ��ѧ/2023�괺��Python/0310/����ѧ�ź������Ƚ�v3--��Ѷ���鿼��ר��--12��.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

解决方法;

 在代码文件的第一行加入:

# coding=utf-8

posted @ 2023-03-16 13:40  emanlee  阅读(54)  评论(0编辑  收藏  举报