成功解决ERROR: Failed building wheel for pycocotools

成功解决ERROR: Failed building wheel for pycocotools

 

 

 

目录

解决问题

解决方法


 

 

 

解决问题

ERROR: Failed building wheel for pycocotools

(CV202001) PS C:\Users\niu> 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: 'D:\ProgramData\Anaconda3\envs\CV202001\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\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\niu\AppData\Local\Temp\pip-wheel-_fwfwnii' --python-tag cp36
       cwd: C:\Users\niu\AppData\Local\Temp\pip-install-f24aas2b\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:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\ProgramData\Anaconda3\envs\CV202001\lib\site-packages\numpy\core\include -Icommon -ID:\ProgramData\Anaconda3\envs\CV202001\include -ID:\ProgramData\Anaconda3\envs\CV202001\include "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\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:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\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 ... error
    ERROR: Command errored out with exit status 1:
     command: 'D:\ProgramData\Anaconda3\envs\CV202001\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\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\niu\AppData\Local\Temp\pip-record-8f1bp3n2\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\niu\AppData\Local\Temp\pip-install-f24aas2b\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:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\ProgramData\Anaconda3\envs\CV202001\lib\site-packages\numpy\core\include -Icommon -ID:\ProgramData\Anaconda3\envs\CV202001\include -ID:\ProgramData\Anaconda3\envs\CV202001\include "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\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:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\ProgramData\Anaconda3\envs\CV202001\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\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:\User

 

 

解决方法

T1、直接命令法

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

参考文章https://github.com/philferriere/cocoapi

 

T2、先编译后下载法

git clone https://github.com/pdollar/coco.git
cd coco/PythonAPI
python setup.py build_ext --inplace                # install pycocotools locally
python setup.py build_ext install                     # install pycocotools to the Python site-packages

遇到的坑成功解决 cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp” 和 cl: 命令行 error D8021 :无效的数值参数“/Wno-unused-function”​​​​​​​
参考文章https://www.jianshu.com/p/de455d653301

哈哈,成功安装!

 

 

 

 

 

发布了1565 篇原创文章 · 获赞 6112 · 访问量 1186万+

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 代码科技 设计师: Amelia_0503

分享到微信朋友圈

×

扫一扫,手机浏览