兄弟们,有没有遇到过【 error: Microsoft Visual C++ 14.0 or greater is required】怎么办?
经常遇到,这次就拿出来给大家看看!!!
1.遇到问题啦
我在兴致勃勃的安装包,什么?你居然安装不下来?
pip install paddleocr paddlenlp paddlespeech moviepy
夸嚓,一下子,红颜色字就出来了,这怎么整?
Building wheel for webrtcvad (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating buildlib.win-amd64-cpython-39
copying webrtcvad.py -> buildlib.win-amd64-cpython-39
running build_ext
building '_webrtcvad' 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 webrtcvad
。
。
。
error: subprocess-exited-with-error
× Running setup.py install for webrtcvad did not run successfully.
│ exit code: 1
╰─> [11 lines of output]
running install
I:miniconda3envsp2libsite-packagessetuptoolscommandinstall.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating buildlib.win-amd64-cpython-39
copying webrtcvad.py -> buildlib.win-amd64-cpython-39
running build_ext
building '_webrtcvad' 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.
╰─> webrtcvad
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
2.网上的解决办法
查看错误信息,给出的是 error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: visualstudio.microsoft.com/visual-cpp-…
看出来是需要新版本的 Microsoft C++ Build Tools,并给出了地址,这个要记下来,接下来要考。
打开网址:visualstudio.microsoft.com/zh-hans/vis… ,Microsoft C++ 生成工具,独立 MSVC 编译器、库和脚本。直接下载就是。
3.安装Microsoft C++ 生成工具
点击单个组件,电机安装MSVC v143-VS 2022 C++ x64/86生成工具(最新),安装即可,接下来再试试。
4.原因剖析
4.1原版解释
Even though Python is an interpreted language, you may need to install Windows C++ compilers in some cases. Unlike Linux, compilers for Windows are not included by default in the OS.
For example, you will need to use them if you wish to:
-
Install a non-pure Python package from sources with Pip (if there is no Wheel package provided).
4.2中文意思
尽管Python是一种解释型语言,但在某些情况下可能需要安装Windows c++编译器。与Linux不同,Windows的编译器在默认情况下不包括在操作系统中。
因此,你需要安装编译器
- 用源码安装一个非纯python的包
- 编译cython 或 Pyrex 文件
具体可以看python文档,说的比较细致:
wiki.python.org/moin/Window… ,并给出了版本搭配。
Visual C++ | CPython |
---|---|
14.x | 3.5 – 3.10 |
10.0 | 3.3 – 3.4 |
9.0 | 2.6 – 2.7, 3.0 – 3.2 |
本文正在参加 人工智能创作者扶持计划