pyaudio could not import _portaudio

前端 未结 4 1070
再見小時候
再見小時候 2020-12-17 18:25

Trying to run python app that uses pyaudio. Using virtualenv and installations are working. However when running it can\'t find portaudio. But the _portaudio.so file exists.

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 18:53

    The issue isn't that it can't find the library, but that the library is missing a function that is needed. (source code). I ran into the same problem, and believe the issue stems from building with the wrong version of portaudio-dev.

    What you need to do:

    1. Uninstall python-pyaudio with sudo apt-get purge --remove python-pyaudio if you have it (This is version 0.2.8)
    2. Download the latest version (19) of PortAudio.
    3. Untar and install PortAudio
      • ./configure
      • make
      • make install
    4. Get the dependencies for pyaudio
      • portaudio19-dev
      • python-all-dev (python3-all-dev for Python 3)
    5. sudo pip install pyaudio

    After that, I was able to use pyaudio.

提交回复
热议问题