PyQt on the Mac: Difference between revisions
Brian Wilson (talk | contribs) mNo edit summary |
Brian Wilson (talk | contribs) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Still working on this article... not sure how things will shake out yet. Come back tomorrow. | |||
PyQt is a set of bindings for Python that allow you to build applications using the QT framework. So, in theory you can build one application that runs on any platform that supports Python and QT. This includes Macintosh, Linux, and Windows. | PyQt is a set of bindings for Python that allow you to build applications using the QT framework. So, in theory you can build one application that runs on any platform that supports Python and QT. This includes Macintosh, Linux, and Windows. | ||
There is no binary installer for | = PyQT on my Mac = | ||
My computer is: | |||
* MacBook Pro running Snow Leopard 10.6.3 | |||
* 64-bit Core Duo 2 processor, 8 GB ram, 500 gb disk | |||
There is currently no binary installer for this configuration, you have to build it. | |||
I went down the path of installing the first copy of QT that I found at the Nokia site, then tried to build and install PyQT only to have it gripe that the QT installation was 32-bit. | |||
I searched and found files marked as 64-bit versions of the QT binaries tucked away [http://qt.nokia.com/downloads/mac-os-cpp here]. It ''says'' 64-bit but appears to still be 32-bit. Or maybe the PyQT build is really finding one of the previously installed 32-bit versions. | |||
But for some reason installing those did not help either. | |||
So, back to the drawing board. | |||
== Building QT 4.6.2 for 64-bit == | |||
First I deleted all the copies of Qt left floating around my system in /Applications, /Developer/Applications, /Developer/Tools, and /usr/local from previous attempts. | |||
Then I downloaded the latest source tarball from http://qt.nokia.com/downloads | |||
./configure -arch x86_64 | |||
make | |||
sudo make install | |||
This build is taking a ''long'' time on my MacBook. But at least this time I can see it's building a 64-bit app. The compile lines flying by contain the -arch x86_64 tag. This is promising. | |||
When it's done I will have... what? I think it installs into /usr/local by default. Not very Mac-ish but as a Linux hack I think it's a fine place. | |||
== Building PyQT == | |||
Then you have to build and install '''PyQT'''. | First you have to build and install '''SIP'''. SIP is a tool for creating C/C++ bindings. Then you have to build and install '''PyQT'''. | ||
For SIP: | |||
export MACOSX_DEPLOYMENT_TARGET=10.6 | |||
python configure.py -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip --use-arch=x86_64 | |||
make | |||
sudo make install | |||
For PyQt: | |||
./ | export QTDIR=/Developer/Applications/Qt | ||
python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch=x86_64 | |||
make | |||
sudo make install |
Latest revision as of 15:21, 19 May 2010
Still working on this article... not sure how things will shake out yet. Come back tomorrow.
PyQt is a set of bindings for Python that allow you to build applications using the QT framework. So, in theory you can build one application that runs on any platform that supports Python and QT. This includes Macintosh, Linux, and Windows.
PyQT on my Mac
My computer is:
- MacBook Pro running Snow Leopard 10.6.3
- 64-bit Core Duo 2 processor, 8 GB ram, 500 gb disk
There is currently no binary installer for this configuration, you have to build it.
I went down the path of installing the first copy of QT that I found at the Nokia site, then tried to build and install PyQT only to have it gripe that the QT installation was 32-bit.
I searched and found files marked as 64-bit versions of the QT binaries tucked away here. It says 64-bit but appears to still be 32-bit. Or maybe the PyQT build is really finding one of the previously installed 32-bit versions.
But for some reason installing those did not help either. So, back to the drawing board.
Building QT 4.6.2 for 64-bit
First I deleted all the copies of Qt left floating around my system in /Applications, /Developer/Applications, /Developer/Tools, and /usr/local from previous attempts.
Then I downloaded the latest source tarball from http://qt.nokia.com/downloads
./configure -arch x86_64 make sudo make install
This build is taking a long time on my MacBook. But at least this time I can see it's building a 64-bit app. The compile lines flying by contain the -arch x86_64 tag. This is promising.
When it's done I will have... what? I think it installs into /usr/local by default. Not very Mac-ish but as a Linux hack I think it's a fine place.
Building PyQT
First you have to build and install SIP. SIP is a tool for creating C/C++ bindings. Then you have to build and install PyQT.
For SIP:
export MACOSX_DEPLOYMENT_TARGET=10.6 python configure.py -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip --use-arch=x86_64 make sudo make install
For PyQt:
export QTDIR=/Developer/Applications/Qt python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch=x86_64 make sudo make install