1. 问题描述

如题,在Windows 10 x64主机的Python Anaconda虚拟环境中安装pycocotools包时报错。安装命令为:

pip install pycocotools

执行后报错,如下所示:

Collecting pycocotools
  Using cached https://files.pythonhosted.org/packages/96/84/9a07b1095fd8555ba3f3d519517c8743c2554a245f9476e5e39869f948d2/pycocotools-2.0.0.tar.gz
Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\test\Anaconda3\envs\cu100_py37_torch120\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\test\\AppData\\Local\\Temp\\pip-install-09qyqdlo\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\test\\AppData\\Local\\Temp\\pip-install-09qyqdlo\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\test\AppData\Local\Temp\pip-wheel-fx81fe0f' --python-tag cp37
       cwd: C:\Users\test\AppData\Local\Temp\pip-install-09qyqdlo\pycocotools\
  Complete output 
Windows安装 pycocotools 失败:ERROR: Failed building wheel for pycocotools .microsoft.com/visual-cpp-build-tools/ ---------------------------------------- ERROR: Failed building wheel for pycocotools Failed to build pycocotools ERROR: Could not build whee 在pycharm等IDE集成开发环境中出现以下错误时,即Error running '***': Cannot run program "C:\Users\Administrator\PycharmProjects\*****\venv\Scripts\python.exe" (in directory "C:\Users\Administrator\PycharmProjects\*****")... 到visual studio官网下载visual studio installer 打开后,如果没下visual studio就可以看到workloads(中文叫工作负载)选项的界面,如果没下就在“修改”那边选择。 在workloads(中文叫工作负载)勾选上c++生成工具 最后点击“安装”等待完成。 1.第一种方法: 在终端中直接输入: pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI 这个方法是在目前网上最常见的解决方法,但是试过几次都没有成功(不过网上很多人用这个方法都成功了,可能人品不行。。。。) 2.第二种方法: ERROR: Command errored out with exit status 1: 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-amd6. 所以,pycocotools的问题,如果网上其他的方法无法解决的话,可以试试先把2和3装完再去装pycocotools或者requirements。再就是pycocotools的bug,我最近遇到后的解决方法是先把2和3解决后,再装pycocotools自然就能装上了。所以,最好在容器建立好后,先update一下。 最近在部署tensorflow2的时候,总是遇到下面错误:(ERROR:Failed building wheel for pycocotools),具体信息如下:一般这种问题,会出现在windows安装上,可以使用下面命令进行安装: 但是!!但是!!但是!!有时候,我并不是单独安装这一个pycocotools,比如我要安装tf-models-official==2.5.1的时候,通常使用下面命令: 也会遇到这个错误……直接看结论:1. 找到下载网址,下载该文件tf-models-official 深度学习部署:Windows安装pycocotools报错解决方法1.pycocotools库的简介2.pycocotools安装的坑3.解决办法 本系列是作者在跑一些深度学习实例时,遇到的各种各样的问题及解决办法,希望能够帮助到大家。 1.pycocotools库的简介   pycocotoolspython api tools of COCO。COCO是一个大型的图像数据集,用于目标检测、分割、人的关键点检测、素材分割和标题生成。这个包提供了Matlab、Python和luaapi,这些api有助于在 首先:conda install git 然后:pipinstall "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI" Collecting pycocotools Using cached https://files....