florianletsch
florianletsch

Reputation: 465

Setup Qt4 and PyQt for Python 2.6 under MacOS

I downloaded Qt4 from http://qt.nokia.com/downloads/ and installed it.

Using MacPorts I tried to install PyQt as a binding for Python 2.6.1 (which is installed by default in MacOS X Snow Leopard) using both these two lines:

sudo port install py-pyqt4
sudo port install py26-pyqt4

Obviously that didnt work. If I try importing some Qt4-Modules in the interactive python-shell, I get the following error:

>>> import PyQt4.QtCore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PyQt4.QtCore

What did I do wrong? How do I get Python with Qt4 and PyQt running?

Upvotes: 2

Views: 1060

Answers (1)

florianletsch
florianletsch

Reputation: 465

I found the solution myself: PyQt4 was installed correctly and so was Qt4. However, PyQt was installed in the MacPort's installation of python, not in the system's python-installation. To change the installation that will start when executing "python" I selected python26 using macports:

sudo port select python python26

Upvotes: 2

Related Questions