Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] PySide new Mac OS install can't load QtCore.so
The problem was that the various Qt<etc>.framework directories did not exist in /Library/Frameworks. I looked at a system where PyQt4 runs and saw that they were there. On this machine, although I ran the Qt installer, it did not place the necessary frameworks in /Library/Frameworks where apparently Python expects them. I used
@sudo cp -pvR /Developer/SDKs/QtSDK/Desktop/Qt/473/gcc/lib/*.framework /Library/Frameworks@
to make copies, and immediately, PySide came up.
I hope this benefits somebody although I have no idea why the Qt installer did not do this.
---- original question ---
New installation of Qt and PySide on a MacPro desktop machine with Snow Leopard. PySide attempts to load QtCore.so (which does exist in the site-packages/PySide folder) but an error occurs:
@>>> import PySide
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/init.py", line 2, in <module>
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2, in <module>
from QtCore import __moduleShutdown
ImportError: dlopen(/Library/Python/2.6/site-packages/PySide/QtCore.so, 2): Library not loaded: QtCore.framework/Versions/4/QtCore
Referenced from: /Library/Python/2.6/site-packages/PySide/QtCore.so
Reason: image not found@
I tried forcing python2.6 to run in 32-bit mode, but this only changed the message to read:
@ImportError: dlopen(/Library/Python/2.6/site-packages/PySide/QtCore.so, 2): no suitable image found. Did find:
/Library/Python/2.6/site-packages/PySide/QtCore.so: mach-o, but wrong architecture@
(I know I am not alone in this experience, as I found the identical issue posted at Quora.com!)
Well, a day passes, 23 views, no suggestions. Just to make sure, I downloaded PySide and re-installed it, also re-installed Qt, and rebooted. Symptoms the same (see listing in original post). Several significant things here that I don't understand.
The first error message is
@ImportError: dlopen(/Library/Python/2.6/site-packages/PySide/QtCore.so, 2)@
The second message is
@Library not loaded: QtCore.framework/Versions/4/QtCore@
Now the latter exists as part of the Qt SDK. Which I installed in /Developer/SDKs/QtSDK -- which is not the default install location.
Where does python look for the Qt SDK? Do I need to set some kind of environment variable to help it?
I have set a symbolic link ~/QtSDK to where I installed Qt, so it should look as if it was installed in the default location.
Also I have exported DYLD_LIBRARY_PATH=/Developer/SDKs/QtSDK/Desktop/Qt/473/gcc/lib/
Neither step makes any difference, the message is the same as before.