py faster rcnn,UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 10: ordinal not

来源:互联网 发布:ubuntu 命令不提示 编辑:程序博客网 时间:2024/05/29 17:18
cd /usr/lib/python2.7/

sudo gedit posixpath.py

然后加上三行代码:

import sysreload(sys)sys.setdefaultencoding('utf8')

重新运行就可以了,亲测运行通过:

idc@idc-Hi-Fi-Z77X:~/Text-Detection-with-FRCN/py-faster-rcnn/lib/utils$ cython bbox.pyx 

另外当你在py faster rcnn的lib目录下运行make的时候,解决方式跟上述一样的


idc@idc-Hi-Fi-Z77X:~/Text-Detection-with-FRCN/py-faster-rcnn/lib$ lsbuild     fast_rcnn  nms          roi_data_layer  setup.py   utilsdatasets  Makefile   pycocotools  rpn             transformidc@idc-Hi-Fi-Z77X:~/Text-Detection-with-FRCN/py-faster-rcnn/lib$ makepython setup.py build_ext --inplacerunning build_extcythoning utils/bbox.pyx to utils/bbox.cError compiling Cython file:------------------------------------------------------------...# Written by Sergey Karayev# --------------------------------------------------------import numpy as npcimport numpy as np       ^------------------------------------------------------------utils/bbox.pyx:10:8: Compiler crash in AnalyseDeclarationsTransformFile 'ModuleNode.py', line 122, in analyse_declarations: ModuleNode(bbox.pyx:1:0,    full_module_name = 'utils.cython_bbox')File 'Nodes.py', line 408, in analyse_declarations: StatListNode(bbox.pyx:9:0)File 'Nodes.py', line 408, in analyse_declarations: StatListNode(bbox.pyx:10:8)File 'Nodes.py', line 7396, in analyse_declarations: CImportStatNode(bbox.pyx:10:8,    as_name = u'np',    module_name = u'numpy')Compiler crash traceback from this point on:  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Nodes.py", line 7396, in analyse_declarations    self.module_name, self.pos, relative_level=0 if self.is_absolute else -1)  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Symtab.py", line 1191, in find_module    module_name, relative_to=relative_to, pos=pos, absolute_fallback=absolute_fallback)  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Main.py", line 178, in find_module    pxd_pathname = self.find_pxd_file(qualified_name, pos)  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Main.py", line 239, in find_pxd_file    pxd = self.search_include_directories(qualified_name, ".pxd", pos, sys_path=sys_path)  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Main.py", line 280, in search_include_directories    tuple(self.include_directories), qualified_name, suffix, pos, include, sys_path)  File "/usr/local/lib/python2.7/dist-packages/Cython/Utils.py", line 30, in wrapper    res = cache[args] = f(*args)  File "/usr/local/lib/python2.7/dist-packages/Cython/Utils.py", line 148, in search_include_directories    path = os.path.join(dir, dotted_filename)  File "/usr/lib/python2.7/posixpath.py", line 73, in join    path += '/' + bUnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 10: ordinal not in range(128)building 'utils.cython_bbox' extensionx86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c utils/bbox.c -o build/temp.linux-x86_64-2.7/utils/bbox.o -Wno-cpp -Wno-unused-functionutils/bbox.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation. #error Do not use this file, it is the result of a failed Cython compilation.  ^error: command 'x86_64-linux-gnu-gcc' failed with exit status 1Makefile:2: recipe for target 'all' failedmake: *** [all] Error 1



参考文献:

[1]. 

运行py-faster-rcnn遇到的问题

[2].unicode error

阅读全文
0 0
原创粉丝点击