PySide / Qt Import Error

后端 未结 5 1965
醉梦人生
醉梦人生 2020-12-28 16:18

I\'m trying to import PySide / Qt into Python like so and get the follow error:

from PySide import QtCore

ImportError: dlopen(/usr/local/lib/python2.7/site         


        
相关标签:
5条回答
  • 2020-12-28 16:28

    if you watch this , you're question will be fixed: https://github.com/pyside/packaging/blob/master/setuptools/templates/pyside_postinstall.py

    pyside_postinstall.py -install

    0 讨论(0)
  • 2020-12-28 16:28

    I had a similar problem, on Mavericks using a Brew-installed Qt and virtual environment.

    I had to brew reinstall Qt

    Then run the pyside_postinstall.py -install

    See here: https://github.com/Homebrew/homebrew/issues/27898

    0 讨论(0)
  • 2020-12-28 16:30

    I had a similar issue, and I resolved it by manually using otool -L (as seen in the question) and install_name_tool to update the paths.

    install_name_tool -change @rpath/libshiboken.cpython-34m.1.2.dylib /usr/local/lib/python3.4/site-packages/PySide/libshiboken.cpython-34m.1.2.dylib /usr/local/lib/python3.4/site-packages/PySide/QtCore.so
    
    install_name_tool -change @rpath/libpyside.cpython-34m.1.2.dylib /usr/local/lib/python3.4/site-packages/PySide/libpyside.cpython-34m.1.2.dylib /usr/local/lib/python3.4/site-packages/PySide/QtCore.so
    

    I had to do this for several files in the PySide directory before the script would run.

    This blog post is a nice reference: http://thecourtsofchaos.com/2013/09/16/how-to-copy-and-relink-binaries-on-osx/

    0 讨论(0)
  • 2020-12-28 16:44

    Well, the installer is somewhat broken, because the output from oTool should report a full path to the library (the path should be changed by the Pyside installer using install_name_tool).

    Instead of going mad understanding what part of the installer is broken, I suggest you define:

    DYLD_LIBRARY_PATH=/your/path/to/pyside/libraries
    export DYLD_LIBRARY_PATH
    

    This will force the executable loader to scan for libraries into the path you supply too, even it's not configured by the linker.

    0 讨论(0)
  • 2020-12-28 16:48

    i found a solution here

    export DYLD_LIBRARY_PATH=/usr/local/lib/python[version]/site-packages/PySide
    

    for python 3.5 this would be

    export DYLD_LIBRARY_PATH=/usr/local/lib/python3.5/site-packages/PySide
    
    0 讨论(0)
提交回复
热议问题