安装 Cython
首先安装 Cython ,命令如下:
pip install Cython
安装 pycocotools 的错误方式
你使用以下命令安装必定失败:
# 错误的方式 不要使用
pip install -U pycocotools
因为 Windows10 没有编译环境,而且根本也不支持在 Windows10 下进行编译。即使你按照提示去安装 C++ 环境都不行。
安装 pycocotools 的正确方式
正确的安装方式是下面这个命令:
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
github 无响应的问题
大部分是网络原因。我这里有一个变通的方法,使用码云将 cocoapi 同步到码云上然后安装就行了。只需要将上面的地址换成码云的地址就行了:
pip install git+https://gitee.com/felord/cocoapi.git#subdirectory=PythonAPI
成功解决,希望能帮助你,请多多关注。