工程代码中有这么一句
from pycocotools.coco import COCO
需要我的anaconda虚拟环境下安装了pycocotools库;
step1:需要安装visualcppbuildtools full.exe
下载地址:Microsoft Visual C++ Build Tools 2015.
下载后选择默认安装方式安装下即可~
![]()
安装后在Visual C++ Build Tools文件夹下找到Visual C++ 2015 x64 Native Building Tool Command Prompt;

Step2:安装pycocotools
激活你要将这个pycocotools库安装的anaconda虚拟环境;

我这是用conda创建了个叫pytorch_gpu的环境,将pycocotools库装在这个环境下;
然后运行如下指令即可完成安装:
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

主要参考:
https://blog.youkuaiyun.com/qq_28400629/article/details/85247087
https://github.com/maycuatroi/pycocotools-window
本文详细介绍如何在Anaconda虚拟环境中安装pycocotools库,包括安装Visual C++ Build Tools和使用pip安装pycocotools的具体步骤。适用于需要处理COCO数据集的计算机视觉项目。
4854





