PyAudio(PortAudio问题)Python

时间:2018-08-24 05:59:17

标签: python anaconda pyaudio portaudio

我用anaconda python安装了pyaudio。在Windows上使用conda install pyaudio。 它说已安装,并且还安装了PortAudio

但是,当我创建文件并立即运行它时,出现以下问题。

我不知道发生了什么事。

Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
  File "C:\Users\This PC\Desktop\Py\demo.py", line 2, in <module>
    import pyaudio
  File "C:\Users\This PC\Anaconda3\lib\site-packages\pyaudio.py", line 116, in <module>
    import _portaudio as pa
ImportError: DLL load failed: The specified module could not be found.

2 个答案:

答案 0 :(得分:0)

我遇到了类似的问题。

我能够解决此问题的唯一方法是卸载anaconda,安装最新版本的python,然后重新安装最新版本的conda。

然后我为pyaudio下载了最新的.whl文件,可以在这里找到:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

我将此文件从下载文件中移到anaconda3的site-packages文件夹中: C:\ Users \ Projects \ Anaconda3 \ Lib \ site-packages

在anaconda提示符下运行命令“ pip install pyaudio”或“ python -m pip install pyaudio”后,我就很好了

我希望这会有所帮助!

答案 1 :(得分:0)

我使用Anaconda3在win32 py3中遇到了此错误。重新安装portaudio可以解决此问题:

% Example data
c1  = [1 1 2 3 4 5 6
       1 1 2 3 4 5 6
       1 1 2 3 4 5 6
       2 1 2 3 4 5 6
       3 1 2 3 4 5 6
       3 1 2 3 4 5 6]

% We split the c1 matrix in two parts and calculate its size along the first dimension
A = c1(:,1);
B = c1(:,2:end);
n = size(c1,1);

% We can use sparse(A,1:n,1) to create our matrix:
% sparse([1 1 1 0 0 0
%         0 0 0 1 0 0
%         0 0 0 0 1 1])
% Then using a matrix multiplication we obtain the result:
res  = sparse(A,1:n,1)*B

%If you want to preserve the indices
%res= [[1:max(A(:,1))].',sparse(A,1:n,1)*B] 

它刚刚为我更新了软件包,然后pyaudio能够找到DLL。

相关问题