views:

1182

answers:

2

I'm following a tutorial of making desktop apps. with python and qt4, I downloaded and installed qt creator ide, created the .ui file and then I had to convert it using pyuic4, I've been trying a lot of things and still can't do it.

I thought that pyuic4 would be installed with Qt creator IDE, but it seems that's not the case, so I installed pyqt through macports:

sudo port install py26-pyqt4

I didn't know but that came with qt, so it was about 3 hours building it.

after installing it I tried to convert the .ui again:

$ pyuic4-2.6 principal.ui -o prin.py
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/pyuic.py", line 4, in <module>
    from PyQt4 import QtCore
ImportError: No module named PyQt4

No module named PyQt4? wasn't that what I just installed?

Thanks, and excuse me if my english isn't 100% good.

+5  A: 

I've solved it, you have to use the python of macports instead of the default that comes with OS X, to do that install python_select through macports:

sudo port install python_select
sudo python_select python26
MrAn3
you can also try Homebrew: New package management system for Mac OS X - `github.com/mxcl/homebrew`
abhiomkar
@abhiomkar just type the full URL, dude: http://github.com/mxcl/homebrew no need for coding-quotes to make it **clickable** (I did it as `http://github.com/mxcl/homebrew`, for reference)
Cawas
+2  A: 

I made some notes on building and install PyQt4 on Mac Snow Leopard.

The order is important, and there are some quirks with 64-bit libraries. The default Mac Qt libs are Carbon (32 bit), whereas Mac system Python is 64 bit and needs the Cocoa libs.

Nick
While this is nice to know, I think mac ports / homebrew / apt-get are better solutions for "installation" in general. This info should only be useful to who maintain apt-get alike stuff. Well, anyway, this is the right place to post about it! :)
Cawas
Yes, it would be nice if OSX had package installer like the Ubuntu one. I don't really like having a "parallel system" on my Mac though, i.e. Macports.
Nick