Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyside import error on mac osx

Tags:

python

qt

pyside

I'm trying to use PySide so I did a brew install pyside pyside-tools. However, I get the following error:

>>> from PySide.QtGui import QApplication
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtGui.so, 2): Library not loaded: QtGui.framework/Versions/4/QtGui
  Referenced from: /Library/Python/2.7/site-packages/PySide/QtGui.so
  Reason: image not found

This SO question says to install python 27 and then reinstall pyside but I'm using the native python on mac osx 10.8 and it is already 2.7.2.

The Homebrew recipe for PySide seems to indicate that this should have been fixed but I'm still getting the errors. I made sure libpng is installed as well.

Looking at the path, I know that the QtGui.so file is there. Since I'm new to Python, PySide, and Qt, it is hard for me to Google and further troubleshoot.

If anyone knows why and can provide directions, I will be very grateful. It can involve uninstalling a bunch of stuff and reinstalling. Please give detailed instructions. I did uninstall and try to reinstall and got the same result.

Thank you.

like image 833
okysabeni Avatar asked Nov 15 '12 04:11

okysabeni


1 Answers

I was getting the same error, and I'm using Python installed via Homebrew. I found two PySide libraries in /Library/Python/2.7/site-packages/ . Moving them out of the way, and re-building/installing PySide through Homebrew worked.

like image 113
Steve Avatar answered Nov 05 '22 02:11

Steve