pycocotools是什么?即python api tools of COCO。
COCO是一个大型的图像数据集,用于目的测试、分割、人的重点测试、素材分割和标题生成。这个包提供了Matlab、Python和luaapi,这类api能够帮助在COCO中加载、分析和可视化注解。
COCO网站上也描述了注解的确切格式。Matlab和PythonAPI是完整的,LuaAPI只提供基本功能。
pycocotools库的安装环境:Win10x64 ,python 3.7。无需额外安装vs。
发现网上好多课程都需要额外安装 vc++2015 build tools,感觉非常的麻烦,这里仅需一行命令即可:
pipinstallpycocotools-windows

验证安装是不是成功,输入:import pycocotools._mask as _mask
若没显示错误,则安装成功。

安装pycocotools出现的问题,python版本是3.6.9,在conda环境下:
问题描述gcc -pthread -shared -B /home/hm/anaconda3/envs/lan/compiler_compat -L/home/hm/anaconda3/envs/lan/lib -Wl,-rpath=/home/hm/anaconda3/envs/lan/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/../common/maskApi.o build/temp.linux-x86_64-3.6/pycocotools/_mask.o -o build/lib.linux-x86_64-3.6/pycocotools/_mask.cpython-36m-x86_64-linux-gnu.so
/home/hm/anaconda3/envs/xxx/compiler_compat/ld: build/temp.linux-x86_64-3.6/../common/maskApi.o: unable to initialize decompress status for section .debug_info
/home/hm/anaconda3/envs/xxx/compiler_compat/ld: build/temp.linux-x86_64-3.6/../common/maskApi.o: unable to initialize decompress status for section .debug_info
/home/hm/anaconda3/envs/xxx/compiler_compat/ld: build/temp.linux-x86_64-3.6/../common/maskApi.o: unable to initialize decompress status for section .debug_info
/home/hm/anaconda3/envs/xxx/compiler_compat/ld: build/temp.linux-x86_64-3.6/../common/maskApi.o: unable to initialize decompress status for section .debug_info
build/temp.linux-x86_64-3.6/../common/maskApi.o: file not recognized: file format not recognized
collect2: 错误: ld 返回 1
error: command gcc failed with exit status 1/font
安装pycocotools失败
缘由剖析应该是系统动态链接库和conda环境里的库哪儿出了问题,从错误信息里看出gcc用的是conda环境里的ld,
解决方法尝试用系统的ld,由于假如找不到conda里的ld,会自动用系统的ld
cd到anaconda下环境的目录里,把ld这个文件暂时改成其他名字
不过只不过临时解决而已,可能是我操作不当引起的问题





