本文主要是介绍Windows环境编译webots遇到报错:‘gbk‘ codec can‘t decode byte 0x93 in position 547,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Windows环境下编译webots的官方说明在 https://github.com/cyberbotics/webots/wiki/Windows-installation/ ,概括起来就是:先安装MYSYS2,然后git clone --recurse-submodules -j8 https://github.com/cyberbotics/webots.git ,最后make -j16 (j后面的数字的上限取决于你的CPU的线程数),在make时遇到下面报错:
generating resources/proto-list.xml from PROTO files with prefix "webots://"
Traceback (most recent call last):File "E:/msys64/home/AAA/webots/scripts/packaging/generate_proto_list.py", line 241, in <module>generate_proto_list(tag)File "E:/msys64/home/AAA/webots/scripts/packaging/generate_proto_list.py", line 143, in generate_proto_listinfo = ProtoInfo(str(asset), asset.stem)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "E:/msys64/home/AAA/webots/scripts/packaging/generate_proto_list.py", line 48, in __init__self.contents = file.read()^^^^^^^^^^^
UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 547: illegal multibyte sequence
make: *** [Makefile:128: webots_dependencies] Error 1
make: *** Waiting for unfinished jobs....
解决方案是打开报错中提到的那个py文件(就是E:/msys64/home/AAA/webots/scripts/packaging/generate_proto_list.py),找到下面这一行(这一行就是在报错中提到的第48行self.contents = file.read()的上一行):
with open(self.path, 'r') as file:
把这一行改成
with open(self.path, 'r',encoding='utf-8') as file:
即可。
这篇关于Windows环境编译webots遇到报错:‘gbk‘ codec can‘t decode byte 0x93 in position 547的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!