成功解决  SyntaxError: Non-UTF-8 code starting with \xc0 in file  but no encoding declared; see http://p

 

 

目录

解决问题

解决思路

解决方法

T1、默认GBK格式时,需要在代码顶部加下边一行代码即可(推荐)

T2、修改环境为UTF-8格式


 

 

解决问题

  File "F:\File_Anaconda\2020CV\yolov5-master\20200701.py", line 5
SyntaxError: Non-UTF-8 code starting with '\xc0' in file F:\File_Anaconda\2020CV\yolov5-master\20200701.py on line 5, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
 

 

解决思路

文件”F: \ File_Anaconda \ 2020CV\ yolov5-master \ 20200701。py”,第5行
文件F:\File_Anaconda\2020CV\yolov5-master\20200701.py中以'\xc0'开头的非utf -8代码,在第5行没有声明编码;详情请参阅http://python.org/dev/peps/pep-0263/

 

 

解决方法

T1、默认GBK格式时,需要在代码顶部加下边一行代码即可(推荐)

# coding=gbk

 

T2、修改环境为UTF-8格式

成功解决  SyntaxError: Non-UTF-8 code starting with \xc0 in file  but no encoding declared; see http://p_Computer knowledge

# coding=utf8