Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

windows 7 - 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). 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:

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:Python27libsite-packagespyaudio.py", line 103, in <module>
    sys.exit(-1)
SystemExit: -1

If I look at pyaudio.py, the code that it's failing on is:

# 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 Python27Libsite-packages (where pyaudio.py is) there is a file called 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. Additionally, it says that PortAudio v19 is included in the binary, so I assumed it would just work after running the setup executable.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

~ answer per cgohlke


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...