PySide / Qt Import Error

后端 未结 5 1968
醉梦人生
醉梦人生 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: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/

提交回复
热议问题