Installing PyQt4 from Macports with QtWebKit support


PyQt4 is a Python binding for QT 4 based on the Sip binding generator.

The current version of PyQt installed from Macports keeps crashing Python with “Bus Error” when importing QtWebKit module. Any other module from PyQt works just fine, except for QtWebKit.

To install PyQt, we need the following 4 ports:

Digging into the portfiles, I could see that the ports py25-pyqt4 and py25-sip are outdated, referring to version 4.4.3 and 4.7.6 respectively. Luckily, installing PyQt 4.4.4 and Sip 4.7.9 from source is enough to solve the problem, but if you like to keep your stuff organized with Macports, you will need to update your portfiles. Here is the recipe:

First, you have to install Python from Macports and set it up with python_select.

Then you need to patch your portfiles. Save the bellow patches to your disk and apply them.



Now that you have the patches, just apply them and install the modified ports:

To verify that everything works fine, start the Python interpreter and import the module:

você pode gostar também