我试图为 AI 项目安装 pyaudio,但是当我输入“pip install pyaudio”时,我得到了这个
C:\Users\Admin>pip install pyaudio
Defaulting to user installation because normal site-packages is not writeable
Collecting pyaudio
Using cached PyAudio-0.2.14.tar.gz (47 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyaudio (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
WARNING:root:Warning: VCPKG_PATH envrionment variable not set.
INFO:root:running bdist_wheel
INFO:root:running build
INFO:root:running build_py
INFO:root:creating build\lib.win-amd64-cpython-313\pyaudio
INFO:root:copying src\pyaudio\__init__.py -> build\lib.win-amd64-cpython-313\pyaudio
INFO:root:running build_ext
INFO:root:building 'pyaudio._portaudio' 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 pyaudio
Failed to build pyaudio
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyaudio)
请帮助我,这对我来说非常重要
我已经尽力了,但还是没用。
对于最新版本 0.2.14 有适用于 Python 3.12 版本的轮子,但不包括 3.13。降级你的Python,使用3.12。
或者从源代码编译。或者安装 conda 并使用 conda 安装 PyAudio。