我在尝试导入python模块pjsua时遇到以下错误。我有MacOS10.8.1版本。我验证了http://www.darrensessions.com/?p=292中提供的解决方案,该解决方案似乎已在MacOS-10.7中解决了此问题。好像MacOS-10.8又坏了。我在编译代码时没有遇到任何错误。导入PJSUA模块时,只会出现以下错误。

>>> import pjsua
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pjsua.py", line 59, in <module>
    import _pjsua
ImportError: dlopen(/Library/Python/2.7/site-packages/_pjsua.so, 2): Symbol not found: _AudioOutputUnitStart
  Referenced from: /Library/Python/2.7/site-packages/_pjsua.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/_pjsua.so

非常感谢你的帮助。
谢谢,

最佳答案

一个直截了当的解决方案是(纯粹理论上的,还没有测试过):
看看http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2011-November/013722.html
看,补丁上写着:

# OS X Lion Support
if platform.mac_ver()[0].startswith("10.7"):
extra_link_args += ["-framework", "AudioUnit"]

换行
if platform.mac_ver()[0].startswith("10.7"):


if platform.mac_ver()[0].startswith("10.7") or platform.mac_ver()[0].startswith("10.8"):

重新编译
--编辑--
好吧,我按照我的建议修补了它,然后:
> python ~/a.py
a
> cat ~/a.py
import pjsua

test = "a"
print test

关于python - pjsua:无法导入pjsua python模块,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13021277/

10-12 01:11