安装SSD-Pytorch 编译cocoapi/PythonAPI时报错gcc: error: pycocotools/_mask.c: No such file or directory,报错原因是未安装cython包。
SSD-pytorch版本代码如下:https://github.com/lufficc/SSD
安装pytorch版本SSD,编译cocoapi/PythonAPI 时报错:
(py3_pytorch) xx@ubun:~/cocoapi/PythonAPI$ python setup.py build_ext install
running build_ext
building 'pycocotools._mask' extension
gcc -pthread -B /home/xx/anaconda2/envs/py3_pytorch/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/xx/anaconda2/envs/py3_pytorch/lib/python3.6/site-packages/numpy/core/include -I../common -I/home/xx/anaconda2/envs/py3_pytorch/include/python3.6m -c ../common/maskApi.c -o build/temp.linux-x86_64-3.6/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
../common/maskApi.c: In function ‘rleToBbox’:
../common/maskApi.c:141:31: warning: ‘xp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if(j%2==0) xp=x; else if(xp<x) { ys=0; ye=h-1; }
^
gcc -pthread -B /home/xx/anaconda2/envs/py3_pytorch/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/xx/anaconda2/envs/py3_pytorch/lib/python3.6/site-packages/numpy/core/include -I../common -I/home/xx/anaconda2/envs/py3_pytorch/include/python3.6m -c pycocotools/_mask.c -o build/temp.linux-x86_64-3.6/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
gcc: error: pycocotools/_mask.c: No such file or directory
error: command 'gcc' failed with exit status 1
解决方法:
conda install cython