在Linux中的Python中加入ALSA模組

在Linux中的Python中加入ALSA模組

我最近開始在 Linux 上工作,我想在我的 Python 中加入 ALSA 模組。我用過這個,

sudo apt-get install libasound2-dev

之後我安裝了 pyalsa 軟體包,

pyalsa installation,
wget ftp://ftp.alsa-project.org/pub/pyalsa/pyalsa-1.0.14rc3.tar.bz2

tar xf pyalsa-1.0.14rc3.tar.bz2

$ python setup.py build

# python setup.py install

但是當我在Python中輸入help(alsaaudio)時,它給出錯誤,沒有這樣的模組

據 alsaaudio 報道,(http://pyalsaaudio.sourceforge.net/pyalsaaudio.html

注意:包裝器與 alsasound 庫(來自 alsa-lib 包)鏈接,並且需要 ALSA 頭檔進行編譯。在建置之前驗證您是否具有 /usr/lib/libasound.so 和 /usr/include/alsa (或類似路徑)。

我不明白這是什麼意思,也不明白我在 Python 中加入 Alsa 模組時做錯了什麼。

答案1

python-pyalsa 在 Debian 中可用於 wheezy/testing/unstable。您不需要從原始碼建置/安裝。

答案2

不需要python setup.py build,當您手動下載模組時您應該這樣做,但是如果您使用安裝pip系統,則不需要使用給定的命令。

在基於 debian 的系統中,您可以看到以下公式:

python-modulename #python2 
python3-modulename #python3

但如果你在 debian 儲存庫中沒有找到,你可以透過或不透過 downunlowd 下載,只需使用:

pip install yourmoudle
pip3 install yourmodule

在程式設計師使用 pip 系統之前easy_install

相關內容