Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

robot - Python for Naoqi (dynamic module not initialized properly)

Hi guys I am having a problem with Python and Naoqi for Pepper robot. I've set the right path to NaoqiSDK and when I run "import naoqi" I get this error:

>>> import naoqi
Traceback (most recent call last):
File"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 548, in <module>
 main()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 530, in main
 known_paths = addusersitepackages(known_paths)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 266, in addusersitepackages
user_site = getusersitepackages()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 241, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 231, in getuserbase
USER_BASE = get_config_var('userbase')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 520, in get_config_var
return get_config_vars().get(name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 453, in get_config_vars
import re
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 108, in <module>
import _locale
SystemError: dynamic module not initialized properly

Is there anyone who knows anything about this, how to fix it?

I would appreciate any help about this. Thank you

P.s. I'm running this on OSX

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Similarly to running any NAOqi binary, you may need to run your Python interpreter with DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH set properly:

DYLD_LIBRARY_PATH=<installation_directory>/lib DYLD_FRAMEWORK_PATH=<installation_directory> PYTHONPATH=<installation_directory>/lib/python2.7/site-packages python

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...