2

I have been using the Qt C++ framework and now I need to switch to PyQt to use the Python programming language instead. However I am having some trouble installing PyQt on Windows.

I have tried to follow this link: http://blog.oak-tree.us/index.php/2009/05/12/pyqt-windows ANd when I get to the point where I have to enter in the command line: "mingw32-make" (without quotation marks)

I get an error that says 'mingw32-make' is not recognized as an internal or external command, operable program or batch file

Has anyone successfully installed everything needed to be able to develop Qt GUI applications on Windows with Python and can give me some guidance? As I mentioned I already had the Qt SDK installed and working. So I just downloaded Python 2.6.6, PyQt 4.8.3 and Sip 4.12.2. But I don't know how to install all these tools to get something working. Any help will be appreciated.

Thanks.

Sergio
  • 21
  • 1
  • 2

3 Answers3

2

Well, you're in luck of sorts. PyQt distributes binaries that include everything but the docs and source. You will also need/want the sip packages also. Get the PyQt installer for the for the python version you want, in this case 2.6, but I would advise an upgrade to 2.7 if you can (barring and spec related issues with your job). This will get you up and running with pyqt in a matter of moments. This is the best solution IMO. This is what I do, Phil, the PyQt maintainer, keeps these up to date all the time for both x32 and x64 bit machines.

Now the problem with what you're doing is that mingw32-make.exe is probably not in your PATH environment variable and need to call it directly. which is located here with the QT SDK release 5/2010: C:\Qt\2010.05\mingw\bin

Personally, I find it's over rated to build PyQt from source, the binaries include all the dll's and everything you would need, except the docs. For which you can read on the web and use Qt's supplied docs.

Mike Ramirez
  • 10,750
  • 3
  • 26
  • 20
1

It's best to call mingw32-make.exe from the Qt Command Prompt when installing PyQt4 from source. I had quite a few things in my path that interfered, and a few things missing from my path. The Qt Command Prompt sets up the environment for compiling for you.

Shameless plug, but I wrote a guide on setting up the Poppler library on Windows that also covers installing SIP and PyQt4. Just ignore the Poppler parts and follow steps 3, 4 and possibly 7 if you need QScintilla as well.

Gary Hughes
  • 4,400
  • 1
  • 26
  • 40
  • Thanks for the link to your guide, however I am having some errors that maybe you might know about.. the error I'm getting is just for the QT installation and the PyQt. After following the guide I do all the steps and they all finish fine. But when I run the test script to see if things are working I get Traceback (most recent call last): File "C:/Python26/Projects/testInstall", line 6, in print SIP_VERSION_STR, QT_VERSION_STR, PYQT_VERSION_STR NameError: name 'QT_VERSION_STR' is not defined.....did I miss something? – Sergio Apr 16 '11 at 17:36
0

To quote (and rephrase) a related answer:

This may read like your grandpa givin advice, but all answers here did not mention the best way: go nd install ActivePython instead of python.org windows binaries. I was really wondering for a long time why Python development on windows was such a pita - until I installed activestate python. I am not affiliated with them. It is just the plain truth. Write it on every wall: Python development on Windows = ActiveState! you then just pypm install pyqt4 and everything works smoothly. no compile orgy. no strange errors. no terror. Just start coding anddoing real work after five minutes. This is the only way to go on windows. Really.

Community
  • 1
  • 1
Sridhar Ratnakumar
  • 81,433
  • 63
  • 146
  • 187