在linux系统下安装python librtmp包的实现方法
安装librtmp包需要依赖环境较多,机器上已经安装了python2.7版本,安装librtmp包之前需要先安装依赖环境。
1、安装gcc和依赖包
yum install gcc* python-devel libffi-dev* -y
2、安装librtmp
从git上下载源码:
git clone git://git.ffmpeg.org/rtmpdump
cd rtmpdump/librtmp/
make && make install
3、安装setuptools
wget -S https://pypi.python.org/packages/f7/83/2865ee5727b46234c68efb833363dbce1922a191dd46e246853246a46182/setuptools-24.0.2.zip#md5=b7e888eb6867d94ecaf1af7a26a56c72
unzip setuptools-24.0.2.zip
cd setuptools-24.0.2
python setup.py install
4、安装cffi
wget -S https://pypi.python.org/packages/83/3c/00b553fd05ae32f27b3637f705c413c4ce71290aa9b4c4764df694e906d9/cffi-1.7.0.tar.gz#md5=34122a545060cee58bab88feab57006d
tar -zxvf cffi-1.7.0.tar.gz
cd cffi-1.7.0
python setup.py install
5、安装librtmp
wget -S https://pypi.python.org/packages/48/a6/33b1a5864e22de3e59dd29fcbc2602462511c04a31057b16baec639d7d4f/python-librtmp-0.3.0.tar.gz#md5=f7afe8d463214072281998fa84553927
tar -zxvf python-librtmp-0.3.0.tar.gz
cd python-librtmp-0.3.0
python setup.py install
6、检验安装是否成功
输入python命令符,import librtmp,报错:
ImportError: librtmp.so.1: cannot open shared object file: No such file or directory
解决方法:查找到librtmp.so.1路径,复制到lib64目录下即可;
find / -name librtmp.so.1
cp /usr/local/lib/librtmp.so.1 /usr/lib64/
再次输入python命令符,import librtmp,未报错,安装librtmp包成功!
以上这篇在linux系统下安装python librtmp包的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。