3

尝试导入 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

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

4

2 回答 2

1

一种直接的解决方案是(纯理论,尚未测试):

  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. 换线

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

    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
于 2012-10-23T00:09:03.743 回答
0

如上所示,此错误已在 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"]

有趣的是,我遇到了同样的错误:

    macbookproloreto:python admin$ python samples/simplecall.py 
Traceback (most recent call last):
  File "samples/simplecall.py", line 23, in <module>
    import pjsua as pj
  File "/Library/Python/2.7/site-packages/pjsua.py", line 59, in <module>
    import _pjsua
ImportError: dlopen(/Library/Python/2.7/site-packages/_pjsua.so, 2): Symbol not found: _pj_atexit
  Referenced from: /Library/Python/2.7/site-packages/_pjsua.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/_pjsua.so

不明白为什么,因为检查平台版本的 Python setup.py 脚本似乎很好:

>>> import platform
>>> version = platform.mac_ver()[0].split(".")
>>> version
['10', '10', '4']
>>> 
于 2015-07-20T23:23:22.300 回答