pycocotools安装踩坑记录
在ubuntu上安装pycocotools的时候老是安装不成功,最后不断的尝试终于成功了,下面记录这个过程。issue的网址如下:
https://github.com/cocodataset/cocoapi/issues/172
首先是官方的安装方法:
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
make
报错:
/anaconda/envs/py38_default/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /anaconda/envs/py38_default/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /anaconda/envs/py38_default/include -fPIC -I/anaconda/envs/slowfast/lib/python3.8/site-packages/numpy/core/include -I../common -I/anaconda/envs/slowfast/include/python3.8 -c ../common/maskApi.c -o build/temp.linux-x86_64-3.8/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
unable to execute '/anaconda/envs/py38_default/bin/x86_64-conda-linux-gnu-cc': No such file or directory
error: command '/anaconda/envs/py38_default/bin/x86_64-conda-linux-gnu-cc' failed with exit status 1
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 1
按照issue里面的解决方案,首先安装Cython:
sudo pip install cython
如果用的是anaconda,可能需要:
conda install cython
安装之后仍然报错。issue上还说改makefile文件,把里面的python全部改为python3,但是还是不行,而且issue里面有人说只对于windows用户有用。最后尝试了一下:
sudo make
安装成功!如果遇到同样问题的可以按照这个流程试一下。
|