2016-02-29 6 views
10

Ich versuche pyaudio mit pip zu installieren:Installation pyaudio mit Pip in einem virtualenv

pip install pyaudio 

In einem virtualenv aber ich erhalte eine Fehlermeldung:

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

Gesamte Ausgabe:

Collecting pyaudio 
    Using cached PyAudio-0.2.9.tar.gz 
Building wheels for collected packages: pyaudio 
    Running setup.py bdist_wheel for pyaudio ... error 
    Complete output from command /home/mertyildiran/Downloads/VirtualEnvironment/vir1/Cerebrum/ENV/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-GCltlv/pyaudio/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpyR6J73pip-wheel- --python-tag cp27: 
    running bdist_wheel 
    running build 
    running build_py 
    creating build 
    creating build/lib.linux-x86_64-2.7 
    copying src/pyaudio.py -> build/lib.linux-x86_64-2.7 
    running build_ext 
    building '_portaudio' extension 
    creating build/temp.linux-x86_64-2.7 
    creating build/temp.linux-x86_64-2.7/src 
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o 
    src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory 
    #include "portaudio.h" 
         ^
    compilation terminated. 
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

    ---------------------------------------- 
    Failed building wheel for pyaudio 
    Running setup.py clean for pyaudio 
Failed to build pyaudio 
Installing collected packages: pyaudio 
    Running setup.py install for pyaudio ... error 
    Complete output from command /home/mertyildiran/Downloads/VirtualEnvironment/vir1/Cerebrum/ENV/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-GCltlv/pyaudio/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-icMIUV-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/mertyildiran/Downloads/VirtualEnvironment/vir1/Cerebrum/ENV/include/site/python2.7/pyaudio: 
    running install 
    running build 
    running build_py 
    creating build 
    creating build/lib.linux-x86_64-2.7 
    copying src/pyaudio.py -> build/lib.linux-x86_64-2.7 
    running build_ext 
    building '_portaudio' extension 
    creating build/temp.linux-x86_64-2.7 
    creating build/temp.linux-x86_64-2.7/src 
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o 
    src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory 
    #include "portaudio.h" 
         ^
    compilation terminated. 
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

    ---------------------------------------- 
Command "/home/mertyildiran/Downloads/VirtualEnvironment/vir1/Cerebrum/ENV/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-GCltlv/pyaudio/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-icMIUV-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/mertyildiran/Downloads/VirtualEnvironment/vir1/Cerebrum/ENV/include/site/python2.7/pyaudio" failed with error code 1 in /tmp/pip-build-GCltlv/pyaudio 

Was mache ich falsch? Ich bin neu in virtualenvs.

* Ich kann andere Pakete installieren. Ich habe nur einen Fehler für pyaudio Paket.

Durch die Art, wie ich in der Umgebung bin:

(ENV) [email protected]:~/Downloads/VirtualEnvironment/vir1/MyProject$ 
+1

wenn Sie auf Ubuntu 'sudo apt-get install libasound-dev' sind - http://portaudio.com/docs/v19-doxydocs/compile_linux.html – dm03514

+0

Ich bin in der virtualenv wahrscheinlich ist dieses Paket nicht auf meinem installiert virtualenv. Wie kann ich dieses Paket auf virtualenv installieren? Normalerweise kann ich pyaudio von pip installieren. Aber ich bin in virtualenv. – mertyildiran

+0

@ dm03514 Auf der anderen Seite gibt es eine Möglichkeit zur Installation nur mit pip. Weil ich ein Paket für den Vertrieb vorbereite. – mertyildiran

Antwort

9

Einige Pakete erfordern die Unterstützung von nicht-Python-Software, wie gemeinsam genutzte Bibliotheken. Diese können nicht über PIP installiert werden (sie sind keine Python-Pakete!). Im Allgemeinen installieren Sie diese auf dem Host mit dem Paketmanager Ihres Hosts (apt-get oder yum oder dnf, etc ...), oder Sie verwenden etwas wie Docker, um die Abhängigkeiten und Ihre Anwendung zu kapseln.

In Ihrem Fall benötigt Pyaudio eine Reihe von Bibliotheken, einschließlich mindestens portaudio. Sie müssen die entsprechenden Entwicklungspakete auf Ihrem System installieren, wie in den Kommentaren zu Ihrer Frage vorgeschlagen.

+0

Warum gibt es dann ein Paket für Pyaudio? https://pypi.python.org/pypi/PyAudio – mertyildiran

+0

Oder können Sie mir ein anderes Paket mit gleicher Funktionalität und Pip-Installation vorschlagen? – mertyildiran

+0

So gut wie jedes Paket, das Audiounterstützung bietet, benötigt zusätzliche Bibliotheken von Drittanbietern. Es gibt ein Paket für PyAudio, weil das ein Python-Paket ist. Die erforderliche "portaudio" -Bibliothek ist dies nicht. – larsks

13

Das ist für mich gearbeitet, ich hatte das gleiche Problem:

wenn Sie PyAudio in einem virtualenv installieren möchten, installieren Sie die Portaudio Entwicklungs-Header von APT, dann PyAudio:

sudo apt-get install portaudio19-dev 
pip install --allow-unverified=pyaudio pyaudio 

https://pyspotify.mopidy.com/en/latest/api/sink/

+0

es hat perfekt funktioniert. – ShivaGuntuku

+0

es funktionierte .... Vielen Dank ... – vishwakarma09

+0

Dies funktionierte, musste nicht einmal das --allow-unverified-Tag tun –