1、python文件中有中文时,需要在文件头上加入如下代码: # -*- conding: utf-8 -*- 2、python文件需要在linux中双击运行,可在文件头加入: #!/usr/bin/env python