如何创建PJSUA2 Python 3包?

问题描述 投票:0回答:2

我在 Windows 10 上为 Python 3.x 创建 PJSUA2 包非常困难。我从 pjsip 网站下载了源代码,并且能够毫无问题地编译 C++ 代码,但无法为以下版本构建 PJSUA2 模块: Python。文档提到使用 SWIG,但到目前为止我还没有运气。

当我从

make
运行
./pjsip-apps/src/swig
时,我得到以下信息:

Makefile:1: ../../../build.mak: No such file or directory
make: *** No rule to make target '../../../build.mak'.  Stop.

当我从

make
运行
./pjsip-apps/src/swig/python
时,我得到:

sed: -e expression #1, char 8: unterminated `s' command
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1250'>
OSError: [Errno 22] Invalid argument
python3 setup.py build --compiler=mingw32
helper.mak:2: /build/common.mak: No such file or directory
make[1]: *** No rule to make target '/build/common.mak'.  Stop.
helper.mak:2: /build/common.mak: No such file or directory
make[1]: *** No rule to make target '/build/common.mak'.  Stop.
helper.mak:2: /build/common.mak: No such file or directory
make[1]: *** No rule to make target '/build/common.mak'.  Stop.
helper.mak:2: /build/common.mak: No such file or directory
make[1]: *** No rule to make target '/build/common.mak'.  Stop.
running build
running build_py
running build_ext
building '_pjsua2' extension
x86_64-w64-mingw32-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O2 -pipe -fno-ident -I/c/mingw-builds/ucrt64-seh-posix/x86_64-1220-posix-seh-ucrt-rt_v10-rev2/mingw64/opt/include -I/c/mingw-builds/ucrt64-seh-posix/prerequisites/x86_64-zlib-static/include -I/c/mingw-builds/ucrt64-seh-posix/prerequisites/x86_64-w64-mingw32-static/include -D__USE_MINGW_ANSI_STDIO=1 -IC:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/opt/include/python3.9 -c pjsua2_wrap.cpp -o build/temp.mingw_x86_64_ucrt-3.9/pjsua2_wrap.o
pjsua2_wrap.cpp:3841:10: fatal error: pjsua2.hpp: No such file or directory
 3841 | #include "pjsua2.hpp"
      |          ^~~~~~~~~~~~
compilation terminated.
error: command 'C:\\ProgramData\\chocolatey\\bin/x86_64-w64-mingw32-gcc.exe' failed with exit code 1
make: *** [Makefile:37: _pjsua2.so] Error 1

我不明白可能出了什么问题,因为我实际上只下载了源代码,没有接触任何东西。

python windows pjsip pjsua2
2个回答
0
投票

当我尝试首先在 Windows 上安装 PJSIP/PJSUA2 软件包时,它遇到了持续的构建错误,这些错误永远不会消失,而是尝试切换到基于 Linux 的操作系统。如果这不可能,请尝试使用 Windows Linux 子系统\WSL2,这给了我巨大的成功。

(请注意,在 WSL2 中不可能使用音频,这有点违背了目的,具体取决于您的项目的内容)

希望能帮到你!


0
投票

根据文档,您有两种选择

  1. 文档只是放置了下载 SWIG 的链接:) here 并且没有提及任何步骤
  2. MSYS2——推荐 步骤很简单看这里
© www.soinside.com 2019 - 2024. All rights reserved.