如何为python安装pjsua2软件包



我正在尝试使用Python创建软电话。我找到了这个描述pjsua2的链接,但没有任何明确的步骤来定义如何为python安装pjsua2-包。

谁能给我定义一个关于安装可以在python中使用的pjsua2的明确步骤吗?

这些步骤应适用于

步骤1:创建一个目录。/PJSUA2/pjproject/src

步骤2:安装所需的模块

sudo apt-get install libasound2-dev libssl-dev libv4l-dev libsdl2-dev libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev libx264-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libavresample-dev libavutil-dev libavcodec-extra libopus-dev libopencore-amrwb-dev libopencore-amrnb-dev libvo-amrwbenc-dev subversion

步骤3:下载源代码svn co http://svn.pjsip.org/repos/pjproject/trunk pjproject

步骤4:编译主库并安装。如果您正在RPI上尝试,请参阅此链接。基本上,您需要设置正确的CFLAGS,并确保为您的平台正确配置third_party/build/os-auto.mak.in。

$ cd pjproject
$ ./configure  --enable-shared
$ make dep
$ make
$ sudo make install

步骤5:编译并安装python模块。再次确保您有正确的user.mak,如果您正在为RPI 编译它

$ cd pjsip-apps/src/swig/
$ make
$ make install

步骤6:检查已安装的模块

$ python
> import pjsua2

除了RPI扭曲之外,这些步骤在这里都提到了

更新#1:

别忘了设置ep_cfg.uaConfig.threadCnt = 0,否则你会得到Segmentation fault。因此PJSUA2页面中的样本代码应具有更改

def pjsua2_test():
# Create and initialize the library
ep_cfg = pj.EpConfig()
ep_cfg.uaConfig.threadCnt = 0; #Python does not like PJSUA2's thread. It will result in segment fault
ep = pj.Endpoint()
ep.libCreate()
ep.libInit(ep_cfg)

步骤如下所示:https://trac.pjsip.org/repos/wiki/Python_SIP/Build_Install

我浏览了一下,它们在Mac Os X上似乎没有任何问题。你遇到的确切问题是什么?

#新建的系统详细信息

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

$ sudo apt-get install libasound2-dev libssl-dev libv4l-dev libsdl2-dev libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev libx264-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libavresample-dev libavutil-dev libavcodec-extra libopus-dev libopencore-amrwb-dev libopencore-amrnb-dev libvo-amrwbenc-dev subversion python2.7-dev gcc build-essential 
$ wget https://github.com/pjsip/pjproject/archive/refs/tags/2.13.tar.gz && tar -xzvf 2.13.tar.gz && rm 2.13.tar.gz
$ cd pjproject-2.13
$ ./configure  --enable-shared
$ make dep
$ make
$ make install
$ cd pjsip-apps/src/python/
$ python2.7 setup.py install
$ cd

现在测试模块的安装

$ python2.7

运行这个内部外壳

import pjsua

检查模块的版本

$ cat /usr/local/lib/python2.7/dist-packages/pjsua-2.13.egg-info

相关内容

  • 没有找到相关文章

最新更新