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 ?
- Download the SIP package (snapshot for OS x )
- Download the PyQt package (snapshot for OS x)
- Download Qt
- Install Qt
- Install SIP
- Install PyQt
- 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
|
1 |
cd ~/Downloads/sip-4.11-snapshot-052b642f04a8 |
and we are gonna try to install it with the following lines :
|
1 |
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 :
|
1 2 |
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 :
|
1 2 |
cd .. cd PyQt-mac-gpl-snapshot-4.7.5-8a6793a155e0 |
and let’s try to configure it with the right things
|
1 |
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:
|
1 2 |
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.
{ 28 } Comments
Thanks a lot. Finally working !!!
You’r welcome
Your list of commands were a HUGE timesaver and it all worked. THANKS!!!
Thanks man
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.
I found out that X Code have to be installed for the “Make” command to work.
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)
Muchas gracias! this worked wonders i got it with qmake 4.7 just fine.
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??
Hi,
Actually I just read that it could take around 3h to 3h30′
and see later on, if it gives
so you should let it run
any error message.
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.)
It is not working on the lion, the path /usr/bin/qmake-4.6 is not created after installing the SIP.
Dear SSF for your problem, I found a solution -> https://bugreports.qt.nokia.com/browse/QTCREATORBUG-6222
tell me if this helped
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
Oh and last command should be:
/opt/local/bin/python2.7 configure.py -q /Users/jnvilo/QtSDK/Desktop/Qt/474/gcc/bin/qmake -g
Thanks for the tips Jason !
I don’t know why…
I have installed sip-4.13.2 on python 2.7 (on my Mac OSX 10.7.3 Lion). I don’t have errors when I do $ python and then >>import sip or >>import sipconfig.
I have installed qt-mac-opensource-4.8.1.dmg and QtSdk-online-mac-x86-v1.2.1.dmg, but when I enter :
$python configure.py -q /usr/bin/qmake-4.8 -d /Library/Python/2.7/site-packages/ –use-arch i386
I have this error message that I cannot solve by myself :
Determining the layout of your Qt installation…
Error: Failed to determine the layout of your Qt installation. Try again using
the –verbose flag to see more detail about the problem.
How to solve this ? Or how to have more informations on this problem ?
Using the full QT path. I just saw that example
“python configure.py -q /home/mahmoud/qtsdk-2009.05/qt/bin/qmake”
So, try the full path to qmake.
See this : http://ubuntuforums.org/archive/index.php/t-1427945.html
Well in the QtDSK installation I don’t have /qt/bin/qmake things but I have in the qmake command in /usr/bin/qmake (and also a qmake-4.8)…
Btw Have you looked at this http://www.noktec.be/python/how-to-install-pyqt4-on-osx#comment-690 ?
look at the path used.
No changes with :
$python configure.py -q /Users/labo/Documents/QtSDK/Desktop/Qt/4.8.1/gcc/bin/qmake -d /Library/Python/2.7/site-packages/ –use-arch i386 –verbose
I’m sorry I have no more ideas, but if you find the answer could you please tell me so I’ll be able to help similar problems in the future.
You don’t need to go through all the hassle, the PyQtX binaries now provide you everything ready to use!
Hey AbiusX,
I haven’t used PyQTX yet, but I’ll give it a try, and then I’ll edit my post following your comment.
Btw thank you for the head up.
if you get this error msg:
configure.py: error: ‘/usr/bin/qmake-4.6′ is not a file
check if this file exists in /usr/bin.
if it doesn’t, install Qt libraries from:
http://qt.nokia.com/downloads
Hi, I’ve followed your instructions to the letter, but I still can’t install PyQt for Mountain Lion. The only way I can get something done is this:
1. Download and Install Qt 5.0.1 (installs in local directory)
2. Compile Sip 4.14 (all good here)
3. Compile PyQt 4.9.6 with flag -q /Users/Juan/Qt5.0.1/clang_64/bin/qmake (there is no qmake in /usr/bin and /usr/local/bin or /usr/local/Cellar/qt/4.8.4/bin/ throws the following error:
Determining the layout of your Qt installation…
Error: Failed to determine the layout of your Qt installation. Try again using
the –verbose flag to see more detail about the problem.
4. Last step: make, but it does not go all the way through, it stops and throws the following error:
/Users/Juan/Downloads/PyQt-mac-gpl-4.9.6/sip/QtCore/qstring.sip:205:35: error:
use of undeclared identifier ‘TRUE’
static bool check_codec = TRUE;
^
/Users/Juan/Downloads/PyQt-mac-gpl-4.9.6/sip/QtCore/qstring.sip:213:27: error:
use of undeclared identifier ‘FALSE’
check_codec = FALSE;
^
2 errors generated.
make[1]: *** [sipQtCoreQString_0.o] Error 1
make: *** [all] Error 2
Any ideas? Help is appreciated!
PS: I also tried with home-brew… but did not work neither.
Hi,
I’ll try to install it on my Mac tonight or tomorrow, I let you (in the comments) know if I encounter the same problems and if I found any solutions.
{ 2 } Trackbacks
[...] 1-3 were adapted from here. Step 4 was adapted from here. Share this:TwitterFacebookLike this:LikeBe the first to like this [...]
[...] To install PyQt on my system (OS X 10.6.8), with Xcode installed, download and install SIP and PyQt4 following these directions here. [...]
Post a Comment