How to Install PyQt4 on Osx

Note : this is a tutorial on Mac OS X 10.6.4, with : PyQt-mac-gpl-snapshot-4.7.5-8a6793a155e0.tar.gz and with : sip-4.11-snapshot-052b642f04a8.tar.gz.
It should be the same on previous and next versions. ( if you have some bugs you may also contact me )

How to install PyQt4 ?

  1. Download the SIP package (snapshot for OS x )
  2. Download the PyQt package (snapshot for OS x)
  3. Download Qt
  4. Install Qt
  5. Install SIP
  6. Install PyQt
  7. and try !

Let’s download the Qt binary from the website : Download site (You may take the complete SDK)

Let’s download the SIP snapshot : Download site (for OS x)

Let’s download the PyQt snapshot : Download site (for OS x)

And now let’s install the first Qt binary, just follow and click on next until it as finished to install.

SIP :

SIP is the program that bind C++ with Python

let’s  go were you have downloaded the sip tar.gz and enter the folder

 cd ~/Downloads/sip-4.11-snapshot-052b642f04a8

and we are gonna try to install it with the following lines :

 python configure.py -d /Library/Python/2.6/site-packages --arch i386

– arch i386 is to specify that we want this architecture

then lets make it and install it with the following commands :

make
sudo make install

PyQt4:

Once installed let’s move back an go to the PyQt folder to configure it and install it with the following command :

cd ..
cd PyQt-mac-gpl-snapshot-4.7.5-8a6793a155e0

and let’s try to configure it with the right things

python configure.py -q /usr/bin/qmake-4.6 -d /Library/Python/2.6/site-packages/ --use-arch i386

then let’s make them with:

make
sudo make install

and now, everything should be Up and running.

 

In OS X Lion and with the new versions there is a thread on QT website https://bugreports.qt.nokia.com/browse/QTCREATORBUG-6222 which says that qmake-4.7 is hidden in /usr/bin. Could someone confirm that it works.

18 comments

  • QT98 (274 jours)

    Thanks a lot. Finally working !!!

  • Noktec (270 jours)

    You’r welcome ;)

  • me (253 jours)

    Your list of commands were a HUGE timesaver and it all worked. THANKS!!!

  • Noktec (253 jours)

    Thanks man ;)

  • Ecker (198 jours)

    I get to the first « make » command.
    Which just returns « command not found ».

    If I skip it and continue all I get on the next step is « ImportError: No moudle named sipconfig »

    What did I miss? I tried, and tried again.

  • Ecker (198 jours)

    I found out that X Code have to be installed for the « Make » command to work.

  • Noktec (197 jours)

    Yes, Xcode needed to be installed ( in theory everything should work well, on Leopard or Snow Leopard but i didn’t tried yet on Lion)

  • Guillermo (190 jours)

    Muchas gracias! this worked wonders i got it with qmake 4.7 just fine.

  • [...] 1-3 were adapted from here. Step 4 was adapted from here. Share this:TwitterFacebookLike this:LikeBe the first to like this [...]

  • yui (174 jours)

    Hi, I am installing PyQt4 into my MacBookPro (10.6, unibody, core 2 duo, 2009).
    After I launched « $ python configure.py –use-arch=x86_64″,
    It’s been already almost 3 hours..
    Do you think Is it normal it takes so long time??

  • Noktec (173 jours)

    Hi,

    Actually I just read that it could take around 3h to 3h30′
    so you should let it run :) and see later on, if it gives
    any error message.

  • yui (173 jours)

    Thanks a lot for your reply.
    unfortunately it had been running for 6 hours so I just did force quite :(

    Apart from that, in this website, we are supposed to use Python 2.6, aren’t we?
    I am using 2.7, not 2.6, so in that case should I simply put a command something like following??:
    python configure.py -d /Library/Python/2.7/site-packages –arch x86_64

    Sorry for such a very very stupid question.
    I am a beginner for Python (and even for general programming).
    (Now I am trying to build an environment « Spyder2″ for Python2.7 in my Mac.)

  • SSF (27 jours)

    It is not working on the lion, the path /usr/bin/qmake-4.6 is not created after installing the SIP.

  • Noktec (25 jours)

    Dear SSF for your problem, I found a solution -> https://bugreports.qt.nokia.com/browse/QTCREATORBUG-6222

    tell me if this helped

  • Jason Viloria (22 jours)

    I needed to work with python2.7 due to collaboration with other people working on linux using python2.7 and this is what I did.

    1. Install macports and installed python2-7
    2. downloaded and installed the latest QT SDK. it installed it in QtSDK in my home folder /Users/jnvilo/QtSDK
    3. I downloaded the latest SIP version from the site provided and simply did /opt/local/bin/python2.7 configure.py; make ; make install
    4. When i tried to do the same with PyQt it complained about qt being static and I had to run the following command instead:

    python configure.py -q /Users/jnvilo/QtSDK/Desktop/Qt/474/gcc/bin/qmake -g

    I hope this helps
    /jnvilo

  • Jason Viloria (22 jours)

    Oh and last command should be:

    /opt/local/bin/python2.7 configure.py -q /Users/jnvilo/QtSDK/Desktop/Qt/474/gcc/bin/qmake -g

  • Noktec (22 jours)

    Thanks for the tips Jason !

  • chair rail (17 jours)

    I don’t know why…

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

*

Vous pouvez utiliser ces balises et attributs HTML : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
Go to Top