Windows上安装 pycocotools 失败:ERROR: Failed building wheel for pycocotools

什么是pycocotools: pycocotools是python api tools of COCO。COCO是一个大型的图像数据集,pycocotoolos api有助于在COCO中加载、解析和可视化annotations.
问题:在Windows上, 用pip install pycocotools命令安装pycocotools失败

安装pycocotools失败.png

原因:pycocotools的维护者不再提供Windows平台的支持。
解决办法如下

pycocotools is for linux, since you're using windows 10


下面是老的解决方式,不建议采用:

第一步,在anaconda虚拟环境中安装git

conda install git

安装git.png

第二步,用下面的命令安装pycocotools

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

成功安装pycocotools

[注意]:由Anaconda 404报错导致的安装git失败

安装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

https://pypi.org/project/pycocotools-windows/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。