【Win11】 pycocotools安装教程

【Win11】 pycocotools安装教程

1. 安装VS C++

Windows系统必须装有Visual C++ 编译环境(此篇文章略过)

2. 安装pycocotools

  • 我直接用pip指令安装失败,不知道为什么。
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
  • 所以我通过在GitHub上下载源码并解压进行安装,源码链接在这:https://github.com/philferriere/cocoapi
    第一步:下载源码压缩包,并将其解压
    在这里插入图片描述
    第二步:以管理员身份打开CMD,并切换到cocoapi-master\PythonAPI目录下
cd/d D:\1-研究生文件\GitHub代码\cocoapi-master\PythonAPI

【Win11】 pycocotools安装教程_第1张图片
第三步:输入下面两条指令

# install pycocotools locally
python setup.py build_ext --inplace
 
# install pycocotools to the Python site-packages
python setup.py build_ext install

第四步:验证,打开python终端,输入以下指令

import pycocotools
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval

没有错误提醒,安装成功

你可能感兴趣的:(python,git,github)