windows下 ModuleNotFoundError: No module named ‘pycocotools‘

Posted 九章_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了windows下 ModuleNotFoundError: No module named ‘pycocotools‘相关的知识,希望对你有一定的参考价值。

使用coco数据集训练的时候,提示没有安装cocoapi
提示错误如下:
from pycocotools.coco import COCO
ModuleNotFoundError: No module named ‘pycocotools’

cocoapi 说明

pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

卡着不动,先将github转到gitee地址,再进行安装

pip install git+https://gitee.com/wyonging/cocoapi.git#subdirectory=PythonAPI

提示一大推错误,

  Complete output (13 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\\lib.win-amd64-3.8
  creating build\\lib.win-amd64-3.8\\pycocotools
  copying pycocotools\\coco.py -> build\\lib.win-amd64-3.8\\pycocotools
  copying pycocotools\\cocoeval.py -> build\\lib.win-amd64-3.8\\pycocotools
  copying pycocotools\\mask.py -> build\\lib.win-amd64-3.8\\pycocotools
  copying pycocotools\\__init__.py -> build\\lib.win-amd64-3.8\\pycocotools
  running build_ext
  building 'pycocotools._mask' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

其中提示要安装高于14.0的VS:error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: https://visualstudio.microsoft.com/visual-cpp-build-tools/

最终解决方法:
windows下

pip install pycocotools-windows

OK

以上是关于windows下 ModuleNotFoundError: No module named ‘pycocotools‘的主要内容,如果未能解决你的问题,请参考以下文章

如何在windows下安装GIT

如何在windows下安装GIT

window下Nginx怎么安装启动

windows下设置redis本地开机启动

如何在Windows下升级MySQL

windows下怎么安装ctag