基于V3S的语音助手(二)移植pyaudio到开发板
1.前期准备
- portaudio源码
- pyaudio源码
2.交叉编译portaudio
配置
./configure CC=arm-linux-gnueabihf-gcc CXX=CC=arm-linux-gnueabihf-g++ --host=arm-linux-gnueabihf --prefix=/home/book/lichee/model/voice_pr/portaudio/work --build=x86_64-linux-gnu --target=arm-linux-gnueabihf
配置结果会提示你是否安装了相应的库 至少要有oss才行如:
Configuration summary:
Target ...................... arm-unknown-linux-gnueabihf
C++ bindings ................ no
Debug output ................ no
ALSA ........................ no
ASIHPI ...................... no
OSS ......................... yes
JACK ........................ no
编译
make
安装
make install
3.交叉编译pyaduio
配置(!!!CFLAGS和LDFLAGS是交叉编译的python3.6的头文件和库路径和portaudio头文件,库路径):
export CROSS_COMPILE=arm-linux-gnueabihf-
export CC="${CROSS_COMPILE}gcc -pthread"
export LDSHARED="${CC} -shared"
export CFLAGS="-I/home/book/lichee/model/voice_pr/portaudio/work/include -I/home/book/lichee/model/python/Python-3.6.8/work/include/python3.6m"
export LDFLAGS="-L/home/book/lichee/model/voice_pr/portaudio/work/lib -L/home/book/lichee/model/python/Python-3.6.8/work/lib"
生成python egg安装文件
python setup.py bdist_egg
生成的文件在dist文件夹下
4.烧录安装
将生成的PyAudio-0.2.11-py3.6-linux-x86_64.egg文件拷贝到开发板,然后进入python安装的文件夹使用:
easy_install PyAudio-0.2.11-py3.6-linux-x86_64.egg
进行安装
将portauido中的lib复制到板子的usr/lib中
安装好后import pyaudio看是否成功安装