在Windows系统上安装pycocotools

  1. 安装 Visual C++ 2015 Build Tools,
    下载链接为:Visual C++ 2015 Build Tools
    ](https://go.microsoft.com/fwlink/?LinkId=691126),下载后直接点击默认安装即可

2.进入文件夹 C:\Program Files (x86)\Microsoft Visual C++ Build Tools
打开文件夹并运行文件: vcbuildtools_msbuild.bat

3.在anaconda环境的命令行中,输入

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

错误解决办法

ERROR: Command errored out with exit status 1:
command: 'D:\SoftWare\Anaconda\envs\yolo\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\\SoftWare\\System\\TEMP\\Temp1\\pip-install-05yqhaov\\pycocotools\\P
ythonAPI\\setup.py'"'"'; __file__='"'"'D:\\SoftWare\\System\\TEMP\\Temp1\\pip-install-05yqhaov\\pycocotools\\PythonAPI\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);
code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'D:\SoftWare\System\TEMP\Temp1\pip-install-05yqhaov\pycoc
otools\PythonAPI\pip-egg-info'
         cwd: D:\SoftWare\System\TEMP\Temp1\pip-install-05yqhaov\pycocotools\PythonAPI
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "D:\SoftWare\System\TEMP\Temp1\pip-install-05yqhaov\pycocotools\PythonAPI\setup.py", line 2, in <module>
        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

查看最后的报错信息发现没有安装Cython安装即可解决

conda install Cython

猜你喜欢

转载自blog.csdn.net/a18838956649/article/details/103435197