Building PyQt for Maya on Mac

To build PyQt on Mac, usually:

python configure.py
make
sudo make install

should be fine. But Maya 2008 and Maya 2009 on Mac is using the old Python 2.5. To use PyQt inside Maya, it should be specifically built  compatible with that Python comes with Maya. So:

/Applications/Autodesk/maya2009/Maya.app/Contents/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python configure.py
make
 sudo make install

Both Sip and PyQt should be built in this way. Resulting module will appear in /Library/Python/2.5/site-packages/

Copy everything inside to /Applications/Autodesk/maya2009/Maya.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/, sitting next to the maya modules.

Now to test if it works in Maya, run the minimal script in Maya SE:

import sys, os
from PyQt4 import QtCore, QtGui
app = QtGui.QApplication(sys.argv)

addressBook = QtGui.QLabel("Hello world!", None)  
addressBook.show()

A tiny window should appear if everything works as expected.

To skip the building time, download the precompiled package of PyQt and Sip. It is built and tested on Mac OSX 10.5.8.

Revised: This won’t work! Maya will be locked when PyQt is started, even when pumpThread is used.

Advertisements

Leave a comment

Filed under Python

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s