安装pycocotools模块,出现报错:

building 'bitarray._bitarray' extension       
error: Microsoft Visual C++ 14.0 or greater is required. 
Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/       
[end of output],

安装pycocotools模块报错:Microsoft Visual C++ 14.0 or greater is required_编译错误


报错原因:编译pycocotools模块中出现编译错误,需要安装C++的编译

解决办法:安装确实的C++编译依赖安装Microsoft Visual C++ 14.0对应的包:

选择依赖进行安排:

安装pycocotools模块报错:Microsoft Visual C++ 14.0 or greater is required_Visual_02

点击修改或者安装

安装pycocotools模块报错:Microsoft Visual C++ 14.0 or greater is required_c++_03


可以全部安装,不过其实没有必要,因为很多是为了进行C++的代码编译而写的项目模块,对于仅仅是消除bug,其实用处不大,仅需要安装我在打钩的两个部分即可。

重新执行pycocotools的安装模块指令:

pip install pycocotools -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

这里我使用阿里源的镜像,提高安装的速度。

安装pycocotools模块报错:Microsoft Visual C++ 14.0 or greater is required_编译错误_04


以上可以安装成功,bug修复。