问题
I'm getting the below error while trying to import python module pjsua. I have Mac OS 10.8.1 version. I verified the solution provided in http://www.darrensessions.com/?p=292 and the solution seemed to have fixed this issue in MacOS-10.7. Seems like this is broken again for MacOS-10.8. I did not got any errors when compiling the code. Only get the below error when importing PJSUA module.
>>> 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
Your help in highly appreciated. Thanks,
回答1:
One straight-forward solution would be (purely theoretical, haven't tested):
- Look at http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2011-November/013722.html
See, where the patch says:
# OS X Lion Support if platform.mac_ver()[0].startswith("10.7"): extra_link_args += ["-framework", "AudioUnit"]
Change line
if platform.mac_ver()[0].startswith("10.7"):
to
if platform.mac_ver()[0].startswith("10.7") or platform.mac_ver()[0].startswith("10.8"):
Recompile
-- edit --
Ok, I patched it as I suggested and:
> python ~/a.py
a
> cat ~/a.py
import pjsua
test = "a"
print test
回答2:
This error was recently fixed as showed above in PJSIP 2.4 python package:
# OS X Lion (10.7.x) or above support
if version[0] == '10' and int(version[1]) >= 7:
extra_link_args += ["-framework", "AudioUnit"]
The funny thing is that I run in the same error:
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
not understanding why since the Python setup.py script checking the platform version seems to be fine:
>>> import platform
>>> version = platform.mac_ver()[0].split(".")
>>> version
['10', '10', '4']
>>>
来源:https://stackoverflow.com/questions/13021277/pjsua-unable-to-import-pjsua-python-module