什么是pycocotools: pycocotools是python api tools of COCO。COCO是一个大型的图像数据集,pycocotoolos api有助于在COCO中加载、解析和可视化annotations.
问题:在Windows上, 用pip install pycocotools命令安装pycocotools失败
原因:pycocotools的维护者不再提供Windows平台的支持。
解决办法如下:
pycocotools is for linux, since you're using windows 10
- Linux: pip install pycocotools
- Windows:pip install pycocotools-windows
-
https://pypi.org/project/pycocotools-windows/
解决完毕!
下面是老的解决方式,不建议采用:
第一步,在anaconda虚拟环境中安装git
conda install git
第二步,用下面的命令安装pycocotools
pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
[注意]:由Anaconda 404报错导致的安装git失败
解决方法:清理掉当前的镜像路径
conda config --remove-key channels
然后重新配置anaconda资源路径
conda config --add channels https://repo.continuum.io/pkgs/free/win-64/
conda config --add channels https://repo.continuum.io/pkgs/main/win-64/
conda config --set show_channel_urls yes
在Windows anaconda中运行.sh文件的方法,例如
sh data/scripts/COCO.sh
请先执行命令,安装Bash命令支持:
conda install m2-base
来自Lit_ca8c网友的解决方案:
pycocotools is for linux, since you're using windows 10
- Linux: pip install pycocotools
- Windows:pip install pycocotools-windows