简体   繁体   中英

Installing PyAudio in PyCharm on Windows

First of all my project is setup with venv and please note that I am unable to use conda .

I am having issues installing PyAudio via PyCharms on Windows. I have compiled the PortAudio files by myself following various other guides. Now I am trying to install it via the Python Interpreter in PyCharm and can't get it to work. Have tried adding the Include directory in the options via --global-option="-I/path-here" , doesn't get recognized, same with adding it to the Interpreter Paths.

src/_portaudiomodule.c(29): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "portaudio.h": No such file or directory

I've had no issues on Linux, since installing PortAudio is simple and the PyAudio installation then works via PyCharm.

So, whilst writing this in complete desparation and before I throw the effort away: I switched to Python 3.6 (was using 3.7), installed PyAudio on first try without any problems. So if anyone comes across this problem, please try this. It even says that PyAudio Version 0.2.11 only supports Python up to 3.6.

You can manually download the PyAudio module and install it from here: https://pypi.org/project/PyAudio/#files

Part 1. In PyCharm:

  • go to "File";
  • "Settings";
  • "Project";
  • push this button ">" 在此处输入图像描述 ;
  • "Python interpreter";
  • push a gear wheel button在此处输入图像描述 ;
  • "Add";
  • "System Interpreter";
  • choose python version installed on your system;
  • If you see "PyAudio" in the list it's mean that you finished. If you don't see PyAudio then go to part 2.

Part 2. For windows 10:

  • push "Start" button;
  • right mouse button click on "This PC";
  • "Properties";
  • "Advanced system settings";
  • "Environment Variables";
  • in "User Variables" double click on "Path";
  • make sure that paths "python3.xx/script" and "python3.xx" for your python version (which you choose in the part 1 of this instruction) are on the top of your list. If not, click "Move up" button在此处输入图像描述 ;
  • push "Ok" buttons.

Part 3. Installing PyAudio

Go to "Start" -> "cmd" -> type "pip install pyaudio" and push "Enter" button. That's all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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