简体   繁体   English

Python PyAudio安装问题(使用PortAudio)

[英]Python PyAudio installation problems (with PortAudio)

I'm trying to write a program to record information from my computers microphone an save it to a file. 我正在尝试编写一个程序来记录来自我的计算机麦克风的信息并将其保存到文件中。 PyAudio seems like one of the better packages for doing this, and they even have a binary for Windows 7 (Python 2.7). PyAudio似乎是做这个的更好的软件包之一,他们甚至有一个Windows 7的二进制文件(Python 2.7)。 I downloaded the executable file and ran it to set up PyAudio, but when I try to import PyAudio into a python script now I get an error: 我下载了可执行文件并运行它来设置PyAudio,但是当我尝试将PyAudio导入python脚本时,我得到一个错误:

Please build and install the PortAudio Python bindings first.

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pyaudio
  File "C:\Python27\lib\site-packages\pyaudio.py", line 103, in <module>
    sys.exit(-1)
SystemExit: -1

If I look at pyaudio.py, the code that it's failing on is: 如果我查看pyaudio.py,它失败的代码是:

# attempt to import PortAudio
try:
    import _portaudio as pa
except ImportError:
    print "Please build and install the PortAudio Python " +\
          "bindings first."
    sys.exit(-1)

Also, in case it's relevant, if I go to Python27\\Lib\\site-packages (where pyaudio.py is) there is a file called portaudio_x64.dll . 另外,如果它是相关的,如果我去Python27\\Lib\\site-packages (其中pyaudio.py是),有一个名为portaudio_x64.dll的文件。

The documentation on their site only seems to have instructions for if you want to install PyAudio by building from source code. 如果您想通过从源代码构建来安装PyAudio,那么他们网站上的文档似乎只有说明。 Additionally, it says that PortAudio v19 is included in the binary, so I assumed it would just work after running the setup executable. 此外,它说PortAudio v19包含在二进制文件中,所以我认为它在运行安装程序可执行文件后才会起作用。

I have no idea what's going wrong and I really need this running soon. 我不知道出了什么问题,我真的很快就需要这个。 Any ideas on what's going wrong? 什么出问题的任何想法? Or if anyone has recommendations for similar packages that work better specifically with Windows 7 (64-bit) and Python 2.7 (Enthought distribution), as well as cross-platform, I'd love to hear them. 或者,如果有人推荐类似的软件包,这些软件包更适用于Windows 7(64位)和Python 2.7(Enthought发行版),以及跨平台,我很乐意听到它们。

Copying the answer from the comments in order to remove this question from the "Unanswered" filter: 复制评论中的答案,以便从“未答复”过滤器中删除此问题:

Try the binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio 试试http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio上的二进制文件

~ answer per cgohlke 〜每个cgohlke回答

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM