SyntaxError: Non-ASCII character '\xe8' in file lane_detector.py on line 5, but no encoding declared;

简介: 在进行编译运行的时候报的错,此错是中文乱码的问题,就算是注释也不行.我们需要指定字符集

解决方案如下:

# -*- coding:UTF-8 -*-
相关文章
|
4月前
|
编解码 开发者 Python
【Python】已解决:UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\u0157’ in position 1: illegal m
【Python】已解决:UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\u0157’ in position 1: illegal m
54 1
|
4月前
|
编解码 测试技术 Python
【Python】已解决:UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-1: ordinal not i
【Python】已解决:UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-1: ordinal not i
712 1
|
4月前
|
Python
SyntaxError: Non-ASCII character 与 Cannot decode using encoding "ascii" 错误解决
SyntaxError: Non-ASCII character 与 Cannot decode using encoding "ascii" 错误解决
49 0
|
4月前
|
编解码 开发者 Python
【Python】已解决:SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: t
【Python】已解决:SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: t
420 0
|
4月前
|
编解码 开发者 Python
【Python】已解决:UnicodeEncodeError: ‘utf-8’ codec can’t encode characters in position 42-43: surrogates
【Python】已解决:UnicodeEncodeError: ‘utf-8’ codec can’t encode characters in position 42-43: surrogates
364 0
|
4月前
|
编解码 程序员 开发者
【Python】已解决:UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xa1 in position 0: invalid start by
【Python】已解决:UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xa1 in position 0: invalid start by
3018 0
|
5月前
|
Python
SyntaxError: Non-ASCII character 与 Cannot decode using encoding "ascii" 错误解决
在Python调试中遇到的两种编码错误:1) "Cannot decode using encoding 'ascii'",此错误发生在处理含有非ASCII字节的字符串时;2) "SyntaxError: Non-ASCII character",当程序文件含中文且未声明编码。解决方法是在脚本开头添加 "# -*- coding: utf-8 -*-" 或 "#coding=UTF-8",告知Python使用UTF-8解析,确保文件实际也以UTF-8编码保存。
56 0
|
6月前
|
Python
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
|
6月前
|
编解码 Python Windows
Python文件路径报错SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3: t
Python文件路径报错SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3: t
|
XML 编解码 数据格式
python报错 ‘utf-8‘ codec can‘t encode characters in position xxxx-xxxx: surrogates not allowed
python报错 ‘utf-8‘ codec can‘t encode characters in position xxxx-xxxx: surrogates not allowed
455 0