ImportError library not loaded - "Reason: image not found"



  • With XCode installed, Qt installed and then PyQt installed. I try running:

    from PyQt5 import QtCore
    And I get this error:
    ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyQt5/QtCore.so, 2): Library not loaded: @rpath/QtCore.framework/Versions/5/QtCore Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyQt5/QtCore.so Reason: image not found



  • The two .so files listed are where they supposed to be?

    How did you install PyQt?



  • @mcleary yes they are. Installed from source with configure.py, make, sudo make install etc


  • Lifetime Qt Champion

    Hi,

    Where are you running this script from ?

    One thing that can help is to set the DYLD_FRAMEWORK_PATH environment variable to point to your Qt 5 lib folder.



  • I'll suggest that you print some environment variables to check if the paths for the shared libraries are OK.

    So, from the environment you are trying to execute your python script, try to print PATH, PYTHONPATH and DYLD_LIBRARY_PATH

    Even better, you can try to print this from your python script with something like this

    import os
    print os.environ['PATH']
    print os.environ['DYLD_LIBRARY_PATH']
    print os.environ['PYTHONPATH']
    

    The check if the missing path is listed somewhere


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.