Python for Naoqi (dynamic module not initialized properly)

后端 未结 3 1223
逝去的感伤
逝去的感伤 2021-01-22 18:59

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:

>         


        
相关标签:
3条回答
  • 2021-01-22 19:46

    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
    
    0 讨论(0)
  • 2021-01-22 19:48

    So, I ran in a very similar issue trying to import qi on pynaoqi-python2.7-2.5.5.5-mac64. Here is the Terminal log:

    >>> import qi
    Traceback (most recent call last):
      File "/usr/local/bin/../Cellar/python/2.7.12/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 548, in <module>
        main()
      File "/usr/local/bin/../Cellar/python/2.7.12/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 530, in main
        known_paths = addusersitepackages(known_paths)
      File "/usr/local/bin/../Cellar/python/2.7.12/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 266, in addusersitepackages
        user_site = getusersitepackages()
      File "/usr/local/bin/../Cellar/python/2.7.12/bin/../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 "/usr/local/bin/../Cellar/python/2.7.12/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 231, in getuserbase
        USER_BASE = get_config_var('userbase')
      File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 520, in get_config_var
        return get_config_vars().get(name)
      File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 453, in get_config_vars
        import re
      File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 108, in <module>
        import _locale
    SystemError: dynamic module not initialized properly
    

    I made two modifications which make the import of qi work, however I'm not sure if both were necessary:

    • Running the command csrutil status returned: System Integrity Protection status: enabled. I disabled it restarting the computer and running some command in the Recovery mode's Terminal, then restarted the computer.

    • As can be seen in the log at the beginning of this post, I had in the path of the Traceback a folder called /Cellar/, which was coming from Homebrew. As it happened, I was not using the default python on my computer (running which python confirmed it) but instead Homebrew's.

    0 讨论(0)
  • 2021-01-22 19:48

    You have to use python2.7.10 downloaded directly from https://www.python.org/downloads/release/python-2710/

    It is not enough to use any other 2.7.10.* python version

    0 讨论(0)
提交回复
热议问题