為什麼在 Windows 上安裝 PyAudio 時會出現「需要 Microsoft Visual C 14.0」錯誤?

Mary-Kate Olsen
發布: 2024-11-15 15:31:02
原創
470 人瀏覽過

Why Am I Getting the

Error: "Microsoft Visual C++ 14.0 is required" During PyAudio Installation on Windows

When attempting to install pyaudio on Windows, users may encounter the error: "error: Microsoft Visual C++ 14.0 is required." This error occurs because installing pyaudio requires Microsoft Visual C++ 14.0, also known as MSVC.

Solution:

To resolve this issue, follow these steps:

  1. Determine your Python version: Execute the command python --version in a terminal or command prompt to check your Python version. This will help determine the appropriate MSVC redistributable package to download.
  2. Download Microsoft Visual C++ 14.0 Redistributable: Navigate to the Microsoft website and download the MSVC redistributable package for your version of Windows.
  3. Install MSVC Redistributable: Run the installer and follow the on-screen instructions to install the MSVC redistributable package.
  4. Reinstall PyAudio: After successfully installing MSVC, you can now reinstall pyaudio using the following command:
python -m pip install PyAudio
登入後複製
  1. Verify Installation: Once the installation is complete, import pyaudio in your Python script to verify if it's working properly.

Alternate Method (in case pip installation fails):

  1. Download the PyAudio wheel file: Visit the PyAudio website and download the appropriate wheel file for your Python version and operating system (e.g., PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl).
  2. Navigate to the downloaded file: Use the cd command in a terminal or command prompt to navigate to the directory where the wheel file is downloaded.
  3. Install PyAudio using pip: Execute the following command to install PyAudio using the wheel file:
pip install path_to_wheel_file
登入後複製

For example, if your wheel file is located at ~/Downloads/PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl, the command would be:

pip install ~/Downloads/PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
登入後複製

以上是為什麼在 Windows 上安裝 PyAudio 時會出現「需要 Microsoft Visual C 14.0」錯誤?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板