无论是字符串中的中文,还是 注释中的中文,需要 1、在 py 文件开始处加入 # -*- coding:utf-8 -*- 2、选择右下角的 "UTF-8",“Save with Encoding”,"UTF-8" 参考: 彻底搞懂 Python 编码