win10安装pycocotools

win10安装pycocotools 出现如下错误:

$ pip install pycocotools
Collecting pycocotools
  Using cached pycocotools-2.0.0.tar.gz (1.5 MB)
Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (setup.py): started
  Building wheel for pycocotools (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: 'd:\anaconda\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ZHENGX~1\\AppData\\Local\\Temp\\pip-install-qwghuww9\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\ZHENGX~1\\AppData\\Local\\Temp\\pip-install-qwghuww9\\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\ZHENGX~1\AppData\Local\Temp\pip-wheel-i2lugl_h'
       cwd: C:\Users\ZHENGX~1\AppData\Local\Temp\pip-install-qwghuww9\pycocotools\
  Complete output (19 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\pycocotools
  copying pycocotools\coco.py -> build\lib.win-amd64-3.6\pycocotools
  copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.6\pycocotools
  copying pycocotools\mask.py -> build\lib.win-amd64-3.6\pycocotools
  copying pycocotools\__init__.py -> build\lib.win-amd64-3.6\pycocotools
  running build_ext
  building 'pycocotools._mask' extension
  creating build\temp.win-amd64-3.6
  creating build\temp.win-amd64-3.6\Release
  creating build\temp.win-amd64-3.6\Release\pycocotools
  creating build\temp.win-amd64-3.6\Release\common
  D:\vs2015\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\anaconda\lib\site-packages\numpy\core\include -Icommon -Id:\anaconda\include -Id:\anaconda\include -ID:\vs2015\VC\INCLUDE -ID:\vs2015\VC\ATLMFC\INCLUDE "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99
  cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp”
  error: command 'D:\\vs2015\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for pycocotools
  Running setup.py clean for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
    Running setup.py install for pycocotools: started
    Running setup.py install for pycocotools: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: 'd:\anaconda\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ZHENGX~1\\AppData\\Local\\Temp\\pip-install-qwghuww9\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\ZHENGX~1\\AppData\\Local\\Temp\\pip-install-qwghuww9\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ZHENGX~1\AppData\Local\Temp\pip-record-yyw53cd7\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\anaconda\Include\pycocotools'
         cwd: C:\Users\ZHENGX~1\AppData\Local\Temp\pip-install-qwghuww9\pycocotools\
    Complete output (19 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\pycocotools
    copying pycocotools\coco.py -> build\lib.win-amd64-3.6\pycocotools
    copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.6\pycocotools
    copying pycocotools\mask.py -> build\lib.win-amd64-3.6\pycocotools
    copying pycocotools\__init__.py -> build\lib.win-amd64-3.6\pycocotools
    running build_ext
    building 'pycocotools._mask' extension
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\Release
    creating build\temp.win-amd64-3.6\Release\pycocotools
    creating build\temp.win-amd64-3.6\Release\common
    D:\vs2015\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\anaconda\lib\site-packages\numpy\core\include -Icommon -Id:\anaconda\include -Id:\anaconda\include -ID:\vs2015\VC\INCLUDE -ID:\vs2015\VC\ATLMFC\INCLUDE "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99
    cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp”
    error: command 'D:\\vs2015\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\anaconda\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ZHENGX~1\\AppData\\Local\\Temp\\pip-install-qwghuww9\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\ZHENGX~1\\AppData\\Local\\Temp\\pip-install-qwghuww9\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ZHENGX~1\AppData\Local\Temp\pip-record-yyw53cd7\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\anaconda\Include\pycocotools' Check the logs for full command output.

好吓人,一大堆,查了以下,解决方法如下:

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

如果中途出现

 Cloning https://github.com/philferriere/cocoapi.git to c:\users\zhengx~1\appdata\local\temp\pip-req-build-it3a4w5x
  Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\ZHENGX~1\AppData\Local\Temp\pip-req-build-it3a4w5x'
  fatal: early EOF
  fatal: The remote end hung up unexpectedly
  fatal: index-pack failed
  error: RPC failed; curl 56 SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054
ERROR: Command errored out with exit status 128: git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\ZHENGX~1\AppData\Local\Temp\pip-req-build-it3a4w5x' Check the logs for full command output.

再重试两次就好了,最终

Successfully built pycocotools
Installing collected packages: pycocotools
Successfully installed pycocotools-2.0

参考资料:

  1. https://blog.csdn.net/discoverer100/article/details/101566419
  2. https://blog.csdn.net/XCCCCZ/article/details/82725409?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一位不愿暴露自己的小可爱

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值