【Python】安装pycocotools错误

2018-11-15  本文已影响456人  避雷殝

错误信息:ImportError: No module named 'pycocotools'
或:error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit status 2
或:error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
或:ModuleNotFoundError: No module named 'Cython'

解决方法:

  1. pycocotools安装需要Visual C++ Build Tools,可以在https://visualstudio.microsoft.com/visual-cpp-build-tools/ 下载,原错误信息给出的链接已经失效了
  2. 除此之外,还需要安装Cython,直接pip即可
  3. 在Linux, 运行pip install git+https://github.com/waleedka/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI
    在Windows, 运行pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

Reference: https://github.com/matterport/Mask_RCNN/issues/6

上一篇 下一篇

猜你喜欢

热点阅读