pjsua:无法导入pjsua python modu

2024-06-01 02:54:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我在尝试导入python模块pjsua时遇到以下错误。我有Mac OS 10.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

非常感谢你的帮助。 谢谢


Tags: 模块inimportsomacpackages错误line
2条回答

最近,PJSIP 2.4 python包修复了此错误:

# OS X Lion (10.7.x) or above support
    if version[0] == '10' and int(version[1]) >= 7:
        extra_link_args += ["-framework", "AudioUnit"]

有趣的是我也犯了同样的错误:

^{pr2}$

不明白为什么设置.py脚本检查平台版本似乎很好:

>>> import platform
>>> version = platform.mac_ver()[0].split(".")
>>> version
['10', '10', '4']
>>> 

一个直截了当的解决方案是(纯理论的,未经测试):

  1. http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2011-November/013722.html
  2. 看,补丁上写着:

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

    ^{pr2}$

    if platform.mac_ver()[0].startswith("10.7") or platform.mac_ver()[0].startswith("10.8"):
    
  4. 重新编译

编辑

好吧,我按照我的建议修补了它:

> python ~/a.py 
a
> cat ~/a.py 
import pjsua

test = "a"
print test

相关问题 更多 >