zoukankan      html  css  js  c++  java
  • python 3.8 安装pyaudio pip3 install pyaudio error: Microsoft Visual C++ 14.0 or greater is required.

    E:\Eprogramfiles\Anaconda3\envs\myenvpy38>pip3 install pyaudio
    Collecting pyaudio
      Using cached PyAudio-0.2.11.tar.gz (37 kB)
    Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
    Installing collected packages: pyaudio
        Running setup.py install for pyaudio ... error
        ERROR: Command errored out with exit status 1:
         command: 'c:\python38\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-m6oeci17\\pyaudio_c8557100e30446cabb941c1c6428849d\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-m6oeci17\\pyaudio_c8557100e30446cabb941c1c6428849d\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Administrator\AppData\Local\Temp\pip-record-49wse8x_\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python38\Include\pyaudio'
             cwd: C:\Users\Administrator\AppData\Local\Temp\pip-install-m6oeci17\pyaudio_c8557100e30446cabb941c1c6428849d\
        Complete output (9 lines):
        running install
        running build
        running build_py
        creating build
        creating build\lib.win-amd64-3.8
        copying src\pyaudio.py -> build\lib.win-amd64-3.8
        running build_ext
        building '_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/
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'c:\python38\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-m6oeci17\\pyaudio_c8557100e30446cabb941c1c6428849d\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-m6oeci17\\pyaudio_c8557100e30446cabb941c1c6428849d\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Administrator\AppData\Local\Temp\pip-record-49wse8x_\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python38\Include\pyaudio' Check the logs for full command output.
    WARNING: You are using pip version 21.1.1; however, version 21.3.1 is available.
    You should consider upgrading via the 'c:\python38\python.exe -m pip install --upgrade pip' command.

     ========================================================

    原因

    与是否安装了  Visual C++ 14.0 or greater 无关

     

     

    ========================================================

     解决方案:

    直接用pip安装的pyaudio不支持3.7,所以在安装或import的时候会报错。
    所以直接下载whl文件安装即可。

    whl下载地址:

    https://github.com/intxcc/pyaudio_portaudio/releases

    切换到whl文件目录,直接用pip安装

    pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl

    >>> import pyaudio
    Could not import the PyAudio C module '_portaudio'.
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Users\Administrator\PycharmProjects\untitled\venv\lib\site-packages\pyaudio.py", line 116, in <module>
        import _portaudio as pa
    ModuleNotFoundError: No module named '_portaudio'

    C:\Users\Administrator\PycharmProjects\untitled\venv\Scripts>python
    Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pyaudio
    Could not import the PyAudio C module '_portaudio'.
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Users\Administrator\PycharmProjects\untitled\venv\lib\site-packages\pyaudio.py", line 116, in <module>
        import _portaudio as pa
    ModuleNotFoundError: No module named '_portaudio'
    >>>

    The official PyAudio 0.2.11 does not support Python 3.7+, and trying to install results in the error C1083: Cannot open include file: 'portaudio.h'.

    However, there are unofficial wheels for PyAudio that support 3.7+.

    If you are using the official version, you must use Python 3.6 with PyAudio 0.2.11.

    See http://people.csail.mit.edu/hubert/pyaudio/

    pip will fetch and install PyAudio wheels (prepackaged binaries). Currently, there are wheels compatible with the official distributions of Python 2.7, 3.4, 3.5, and 3.6.

    http://people.csail.mit.edu/hubert/pyaudio/


    ————————————————

    原文链接:https://blog.csdn.net/a506681571/article/details/85201279

  • 相关阅读:
    【JavaScript】explode动画
    【JavaScript】插件参数的写法
    【webpack】理解配置文件
    你真的了解盒模型么
    一看看懂Protocol Buffer(协议篇)
    es7你都懂了吗?今天带你了解es7的神器decorator
    快速了解react
    简单聊一聊那些svg的沿路径运动
    转转RN工程化历程
    微信小程序内嵌网页的一些(最佳)实践
  • 原文地址:https://www.cnblogs.com/emanlee/p/15552932.html
Copyright © 2011-2022 走看看