cython_bbox安装:error: Microsoft Visual C++ 14.0 or greater is required
cython_bbox是一个Python扩展模块,需要使用Cython编译器进行编译。在安装cython_bbox时,有可能会出现错误提示"Microsoft Visual C++ 14.0 or greater is required",这是因为需要安装Microsoft Visual C++ Build Tools或者Visual Studio。以下是cython_bbox安装步骤:
首先,确保你已经安装了Python和pip。
打开命令行窗口,并输入以下命令安装cython_bbox:
pip install cython_bbox
如果提示缺少Microsoft Visual C++ 14.0,则需要安装Microsoft Visual C++ Build Tools或者Visual Studio。你可以从以下链接下载安装:
Microsoft Visual C++ Build Tools: https://visualstudio.microsoft.com/visual-cpp-build-tools/ Visual Studio: https://visualstudio.microsoft.com/downloads/
安装完毕后,再次运行pip install cython_bbox,即可成功安装cython_bbox。
Building wheels for collected packages: cython_bbox Building wheel for cython_bbox (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [5 lines of output] running bdist_wheel running build running build_ext building 'cython_bbox' 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] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for cython_bbox Running setup.py clean for cython_bbox Failed to build cython_bbox Installing collected packages: cython_bbox Running setup.py install for cython_bbox ... error error: subprocess-exited-with-error × Running setup.py install for cython_bbox did not run successfully. │ exit code: 1 ╰─> [18 lines of output] running install D:\python\envs\yolov578\lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer, pypa/build or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !! self.initialize_options() running build running build_ext building 'cython_bbox' 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] note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure × Encountered error while trying to install package. ╰─> cython_bbox note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
这个错误提示是由于安装cython_bbox时缺少Microsoft Visual C++ 14.0或更高版本,你需要安装该工具才能成功构建cython_bbox。你可以通过以下链接下载并安装Microsoft C++ Build Tools:https://visualstudio.microsoft.com/visual-cpp-build-tools/。安装完成后,再次尝试安装cython_bbox即可。另外,提示中还提到了一些关于setup.py install的警告信息,建议使用其他标准工具来代替直接运行setup.py install。
Cython出现 Microsoft Visual C++ 14.0 or greater is required
如何安装 Microsoft Visual C++ 14.0 或更高版本以支持 Cython 编译
下载并安装 Microsoft Visual C++ Build Tools
为了使 Python 的扩展包能够成功编译,特别是像 Cython 这样的工具,在 Windows 平台上通常需要有合适的 C++ 编译环境。当遇到错误提示 error: Microsoft Visual C++ 14.0 or greater is required
时,意味着当前环境中缺失必要的构建工具。
访问官方网站获取最新版的 Microsoft Visual C++ 构建工具是一个有效的解决方案[^2]。具体操作如下:
前往 Visual Studio 官方下载页面 ,这里提供了多种不同配置选项供开发者选择。对于只需要基本的 C/C++ 编译能力的情况来说,“仅限于建立桌面应用”的轻量级安装方案就足够了[^4]。
执行安装过程中的注意事项
在启动安装向导之后,建议勾选以下组件来确保可以顺利处理大多数常见的 Python 包编译需求:
- C++ build tools
- MSVC v14.x - VS 20xx C++ x64/x86 build tools (Latest) (其中 "VS 20xx" 表示具体的年份版本号)
- 如果计划使用特定版本的 Python,则还应该考虑加入对应的 Windows SDK 版本以及 .NET Desktop development 工具集
完成上述设置后继续按照屏幕指示完成整个安装流程即可[^3]。
验证安装是否成功
安装完成后可以通过命令行测试新安装的编译器是否正常工作。打开 PowerShell 或者 CMD 输入简单的 Hello World 测试程序验证编译链路是否通畅:
// hello.cpp 文件内容
#include <iostream>
int main(){
std::cout << "Hello, world!" << std::endl;
}
保存文件为 hello.cpp
后在同一目录下运行下面两条指令来进行编译和执行:
cl /EHsc hello.cpp user32.lib
.\hello.exe
如果一切正常将会看到控制台打印出 "Hello, world!"
字样说明编译环境已经准备完毕[^1]。
相关推荐















