One of the first things I wanted to do when I bought my new Imac, was installing PyQt4, because we are going to use this at work.
Because I didn’t want to pollute my shiny new system, I decided to use the virtualenv technology.
After reading the documentation, I found out it wasn’t as evident as I thought it was going to be.
In order to install PyQt4 on Snow Leopard, you’ll need to install QT. Easy enough, as this is simply installing a dmg. However, as far as I know this is installed systemwide, and thus not only in a virtual environment. Not exactly a problem for me.
Then I created a new virtual environment:
cd ~/environments/
virtualenv PyQt4
Then we can enter the new virtual environment:
cd ~/environments/PyQt4
source bin/activate
Then I downloaded sip and PyQt4 sources for MacOS X and unpacked them.
Because (the already installed) is only availble in a 32-bit version, and Snow Leopard is 64-bit by default, we have to configure both packages to work as 32-bit. First sip:
cd sip-4.10
python configure.py –destdir /Users/bram/Development/python/environments/PyQt4/lib/ –bindir /Users/bram/Development/python/environments/PyQt4/bin/ –incdir /Users/bram/Development/python/environments/PyQt4/include/ –arch i386
makemake install
This will configure sip inside the virtual environment, without polluting the entire system. Please note the –arch i386 parameter, which is necessary for PyQt4 to compile without errors in the next step:
cd ../yQt-mac-gpl-4.7
python configure.py –destdir /Users/bram/Development/python/environments/PyQt4/lib/ –bindir /Users/bram/Development/python/environments/PyQt4/bin/ –use-arch i386