error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools“

简介: error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools“

在window端的anaconda虚拟环境中,想要安装mmdet出现了这个问题,完整的错误如下所示:


Building wheels for collected packages: pycocotools
Building wheel for pycocotools (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pycocotools (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-37
creating build\lib.win-amd64-cpython-37\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-cpython-37\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-cpython-37\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-cpython-37\pycocotools
copying pycocotools_init_.py -> build\lib.win-amd64-cpython-37\pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools_mask.c
building 'pycocotools._mask' extension
C:\Users\Acer\AppData\Local\Temp\pip-build-env-4fck_2gn\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\Acer\AppData\Local\Temp\pip-install-4hy59_ky\pycocotools_12df3f2b8c5940a39d3ddbdaa5df8c1b\pycocotools_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
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]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects



大概就是安装mmdet时需要安装依赖pycocotools,这个是目标检测比较常见的一个工具包,然后安装这个依赖的过程中发生了错误。


问题的可能原因是没有安转Microsoft Visual C++的编译器,定位为error: Microsoft Visual C++ 14.0 or greater is required,那么现在需要的是安装一个Visual studio,为此,我安装了Visual Studio 2019的专业版本之后,随即即可正常安装pycocotools(也可以正常安装mmdet)


如下所示:


(openmmlab) C:\Users\Acer>mim install mmdet
D:\Anaconda3\envs\openmmlab\lib\site-packages_distutils_hack_init_.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html
Collecting mmdet
Using cached mmdet-2.25.2-py3-none-any.whl (1.4 MB)
Collecting pycocotools
Using cached pycocotools-2.0.5.tar.gz (24 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in d:\anaconda3\envs\openmmlab\lib\site-packages (from mmdet) (1.21.6)
Collecting terminaltables
Using cached terminaltables-3.1.10-py2.py3-none-any.whl (15 kB)
Collecting matplotlib
Using cached matplotlib-3.5.3-cp37-cp37m-win_amd64.whl (7.2 MB)
Requirement already satisfied: six in d:\anaconda3\envs\openmmlab\lib\site-packages (from mmdet) (1.16.0)
Requirement already satisfied: mmcv-full>=1.3.17 in d:\anaconda3\envs\openmmlab\lib\site-packages (from mmdet) (1.6.2)
Requirement already satisfied: pyyaml in d:\anaconda3\envs\openmmlab\lib\site-packages (from mmcv-full>=1.3.17->mmdet) (6.0)
Requirement already satisfied: addict in d:\anaconda3\envs\openmmlab\lib\site-packages (from mmcv-full>=1.3.17->mmdet) (2.4.0)
Requirement already satisfied: regex in d:\anaconda3\envs\openmmlab\lib\site-packages (from mmcv-full>=1.3.17->mmdet) (2022.9.13)
Requirement already satisfied: Pillow in d:\anaconda3\envs\openmmlab\lib\site-packages (from mmcv-full>=1.3.17->mmdet) (9.2.0)
Requirement already satisfied: yapf in d:\anaconda3\envs\openmmlab\lib\site-packages (from mmcv-full>=1.3.17->mmdet) (0.32.0)
Requirement already satisfied: packaging in d:\anaconda3\envs\openmmlab\lib\site-packages (from mmcv-full>=1.3.17->mmdet) (21.3)
Collecting fonttools>=4.22.0
Using cached fonttools-4.37.4-py3-none-any.whl (960 kB)
Requirement already satisfied: python-dateutil>=2.7 in d:\anaconda3\envs\openmmlab\lib\site-packages (from matplotlib->mmdet) (2.8.2)
Requirement already satisfied: pyparsing>=2.2.1 in d:\anaconda3\envs\openmmlab\lib\site-packages (from matplotlib->mmdet) (3.0.9)
Collecting cycler>=0.10
Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting kiwisolver>=1.0.1
Using cached kiwisolver-1.4.4-cp37-cp37m-win_amd64.whl (54 kB)
Requirement already satisfied: typing-extensions in d:\anaconda3\envs\openmmlab\lib\site-packages (from kiwisolver>=1.0.1->matplotlib->mmdet) (4.4.0)
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (pyproject.toml) ... done
Created wheel for pycocotools: filename=pycocotools-2.0.5-cp37-cp37m-win_amd64.whl size=74562 sha256=cf3ea032d69b34bb03b6a7aa57dfdccefd5a4efe9b492c60c93febc553166c48
Stored in directory: c:\users\acer\appdata\local\pip\cache\wheels\85\c4\f0\7128093a134f590e4383fd60cb484960878721d98b9a515317
Successfully built pycocotools
Installing collected packages: terminaltables, kiwisolver, fonttools, cycler, matplotlib, pycocotools, mmdet
Successfully installed cycler-0.11.0 fonttools-4.37.4 kiwisolver-1.4.4 matplotlib-3.5.3 mmdet-2.25.2 pycocotools-2.0.5 terminaltables-3.1.10


Visual Studio 2019的安装,自行网上搜索即可。


目录
相关文章
|
2月前
|
C++ 内存技术
[转]Visual C++内嵌swf文件并播放
[转]Visual C++内嵌swf文件并播放
|
3月前
|
安全 编译器 C++
Microsoft Visual C++ Redistributable的作用主要体现以及可以删除吗?
这些是Microsoft Visual C++不同版本的Redistributable安装包,用于32位系统,确保相关应用正常运行。它们提供C++运行时环境,简化部署流程,支持第三方库及框架,并确保应用兼容性。定期更新可修复问题并引入新功能。在空间有限或需解决程序冲突时可考虑删除,但需谨慎操作以防影响应用稳定性和兼容性。删除前请确认无应用依赖,并通过控制面板安全卸载。
156 1
Microsoft Visual C++ Redistributable的作用主要体现以及可以删除吗?
|
3月前
|
缓存 C++ Windows
Inno setup 脚本判断 Microsoft Visual C++ Redistributable 不同版本区别
Inno setup 脚本判断 Microsoft Visual C++ Redistributable 不同版本区别
|
3月前
|
编译器 C++ 开发者
Visual Studio属性表:在新项目中加入已配置好的C++库
通过以上步骤可以确保Visual Studio中新项目成功地加入了之前已配置好的C++库。这个过程帮助开发者有效地管理多个项目中共享的库文件,提升开发效率。
92 0
|
8天前
|
存储 编译器 C++
【c++】类和对象(中)(构造函数、析构函数、拷贝构造、赋值重载)
本文深入探讨了C++类的默认成员函数,包括构造函数、析构函数、拷贝构造函数和赋值重载。构造函数用于对象的初始化,析构函数用于对象销毁时的资源清理,拷贝构造函数用于对象的拷贝,赋值重载用于已存在对象的赋值。文章详细介绍了每个函数的特点、使用方法及注意事项,并提供了代码示例。这些默认成员函数确保了资源的正确管理和对象状态的维护。
34 4
|
9天前
|
存储 编译器 Linux
【c++】类和对象(上)(类的定义格式、访问限定符、类域、类的实例化、对象的内存大小、this指针)
本文介绍了C++中的类和对象,包括类的概念、定义格式、访问限定符、类域、对象的创建及内存大小、以及this指针。通过示例代码详细解释了类的定义、成员函数和成员变量的作用,以及如何使用访问限定符控制成员的访问权限。此外,还讨论了对象的内存分配规则和this指针的使用场景,帮助读者深入理解面向对象编程的核心概念。
32 4
|
1月前
|
存储 编译器 对象存储
【C++打怪之路Lv5】-- 类和对象(下)
【C++打怪之路Lv5】-- 类和对象(下)
27 4
|
1月前
|
编译器 C语言 C++
【C++打怪之路Lv4】-- 类和对象(中)
【C++打怪之路Lv4】-- 类和对象(中)
23 4
|
1月前
|
存储 安全 C++
【C++打怪之路Lv8】-- string类
【C++打怪之路Lv8】-- string类
21 1
|
1月前
|
存储 编译器 C++
【C++类和对象(下)】——我与C++的不解之缘(五)
【C++类和对象(下)】——我与C++的不解之缘(五)