我在尝试导入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
非常感谢你的帮助。 谢谢,
答案 0 :(得分:1)
一个直接的解决方案是(纯理论上,未经测试):
请参阅补丁说明的地方:
# 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
答案 1 :(得分: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']
>>>