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的安装,自行网上搜索即可。


目录
打赏
0
0
0
0
21
分享
相关文章
【Python】已解决error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build
【Python】已解决error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build
4918 0
技术好文:VisualC++查看文件被哪个进程占用
技术好文:VisualC++查看文件被哪个进程占用
[转]Visual C++内嵌swf文件并播放
[转]Visual C++内嵌swf文件并播放
|
7月前
|
Microsoft Visual C++ Redistributable的作用主要体现以及可以删除吗?
这些是Microsoft Visual C++不同版本的Redistributable安装包,用于32位系统,确保相关应用正常运行。它们提供C++运行时环境,简化部署流程,支持第三方库及框架,并确保应用兼容性。定期更新可修复问题并引入新功能。在空间有限或需解决程序冲突时可考虑删除,但需谨慎操作以防影响应用稳定性和兼容性。删除前请确认无应用依赖,并通过控制面板安全卸载。
692 1
Microsoft Visual C++ Redistributable的作用主要体现以及可以删除吗?
|
8月前
|
FFmpeg开发笔记(三十九)给Visual Studio的C++工程集成FFmpeg
在Windows上使用Visual Studio 2022进行FFmpeg和SDL2集成开发,首先安装FFmpeg至E:\msys64\usr\local\ffmpeg,然后新建C++控制台项目。在项目属性中,添加FFmpeg和SDL2的头文件及库文件目录。接着配置链接器的附加依赖项,包括多个FFmpeg及SDL2的lib文件。在代码中引入FFmpeg的`av_log`函数输出"Hello World",编译并运行,若看到"Hello World",即表示集成成功。详细步骤可参考《FFmpeg开发实战:从零基础到短视频上线》。
367 0
FFmpeg开发笔记(三十九)给Visual Studio的C++工程集成FFmpeg
Inno setup 脚本判断 Microsoft Visual C++ Redistributable 不同版本区别
Inno setup 脚本判断 Microsoft Visual C++ Redistributable 不同版本区别
Visual Studio属性表:在新项目中加入已配置好的C++库
通过以上步骤可以确保Visual Studio中新项目成功地加入了之前已配置好的C++库。这个过程帮助开发者有效地管理多个项目中共享的库文件,提升开发效率。
239 0
【C++篇】深度解析类与对象(下)
在上一篇博客中,我们学习了C++的基础类与对象概念,包括类的定义、对象的使用和构造函数的作用。在这一篇,我们将深入探讨C++类的一些重要特性,如构造函数的高级用法、类型转换、static成员、友元、内部类、匿名对象,以及对象拷贝优化等。这些内容可以帮助你更好地理解和应用面向对象编程的核心理念,提升代码的健壮性、灵活性和可维护性。
【C++进阶】特殊类设计 && 单例模式
通过对特殊类设计和单例模式的深入探讨,我们可以更好地设计和实现复杂的C++程序。特殊类设计提高了代码的安全性和可维护性,而单例模式则确保类的唯一实例性和全局访问性。理解并掌握这些高级设计技巧,对于提升C++编程水平至关重要。
39 16
类和对象(中 )C++
本文详细讲解了C++中的默认成员函数,包括构造函数、析构函数、拷贝构造函数、赋值运算符重载和取地址运算符重载等内容。重点分析了各函数的特点、使用场景及相互关系,如构造函数的主要任务是初始化对象,而非创建空间;析构函数用于清理资源;拷贝构造与赋值运算符的区别在于前者用于创建新对象,后者用于已存在的对象赋值。同时,文章还探讨了运算符重载的规则及其应用场景,并通过实例加深理解。最后强调,若类中存在资源管理,需显式定义拷贝构造和赋值运算符以避免浅拷贝问题。