简体   繁体   中英

pyqt installation problem in mac osx snow leopard

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.

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

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.

I spent a while finding the package name in Homebrew. It seems to be:

brew install pyqt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM