如何通过 Conda 安装 pycocotools

Noo*_*les 3 pycocotools

  • 环境

操作系统:Windows 7

蟒蛇:Python 3.7.3

康达:康达 4.8.2

Step1:通过链接器访问从github下载pococtools的源代码:https : //github.com/philferriere/cocoapi

Step2:通过运行构建和安装 pococotall 包

python setup.py build_ext --inplace,

python setup.py build_ext install 
Run Code Online (Sandbox Code Playgroud)

随后。

  1. ModuleNotFoundError:没有名为“Cython”的模块 在此处输入图像描述

    解决方案: pip install Cython

  2. 错误:命令“cl.exe”失败:没有这样的文件或目录 在此处输入图像描述

    解决方案:安装 Visual Studio 2019 并确保安装“Desktop development with c++”环境。

处理完所有问题后,您可以运行两个instrustion完成安装。您可以运行

conda list
Run Code Online (Sandbox Code Playgroud)

然后检查pycocotools。 在此处输入图片说明

在此处输入图片说明

小智 9

我只是查看了这个列表,直到找到一个有效的:

conda install -c conda-forge pycocotools
conda install -c conda-forge/label/gcc7 pycocotools
conda install -c conda-forge/label/cf201901 pycocotools
conda install -c conda-forge/label/cf202003 pycocotools
Run Code Online (Sandbox Code Playgroud)

令人烦恼的是,对于某些设置来说似乎pycocotools安装得很好。但是,当您想要导入它时,脚本将在导入步骤冻结。在这种情况下,只需查看列表并尝试下一个即可。

最后一个(也是最近的)对我有用,所以也许从这里开始。


小智 8

这对我有用:

pip install pycocotools-windows 
Run Code Online (Sandbox Code Playgroud)