pyqt installation problem in mac osx snow leopard

霸气de小男生 提交于 2019-12-23 17:36:15

问题


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.


回答1:


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



回答2:


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.




回答3:


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

brew install pyqt


来源:https://stackoverflow.com/questions/1576629/pyqt-installation-problem-in-mac-osx-snow-leopard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!