开发者

pyqt installation problem in mac osx snow leopard

开发者 https://www.devze.com 2022-12-08 10:44 出处:网络
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 lo

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
Trace开发者_C百科back (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
0

精彩评论

暂无评论...
验证码 换一张
取 消