简体   繁体   English

mac osx雪豹中的pyqt安装问题

[英]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. 使用python和qt4,我下载并安装了qt creator ide,创建了.ui文件然后我不得不使用pyuic4转换它,我一直在尝试很多东西但仍然无法做到。

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: 我认为pyuic4将与Qt creator IDE一起安装,但似乎并非如此,所以我通过macports安装了pyqt:

sudo port install py26-pyqt4

I didn't know but that came with qt, so it was about 3 hours building it. 我不知道,但是qt来了,所以建造它大约需要3个小时。

after installing it I tried to convert the .ui again: 安装后我尝试再次转换.ui:

$ 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? 没有名为PyQt4的模块? wasn't that what I just installed? 那不是我刚安装的那个吗?

Thanks, and excuse me if my english isn't 100% good. 谢谢,如果我的英语不是100%好,请原谅。

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: 我已经解决了,你必须使用macports的python而不是OS X附带的默认值,通过macports安装python_select:

sudo port install python_select
sudo python_select python26

I made some notes on building and install PyQt4 on Mac Snow Leopard . 我做了一些关于在Mac Snow Leopard上构建和安装PyQt4的笔记

The order is important, and there are some quirks with 64-bit libraries. 顺序很重要,并且有一些64位库的怪癖。 The default Mac Qt libs are Carbon (32 bit), whereas Mac system Python is 64 bit and needs the Cocoa libs. 默认的Mac Qt库是Carbon(32位),而Mac系统Python是64位,需要Cocoa库。

I spent a while finding the package name in Homebrew. 我花了一些时间在Homebrew中找到包名。 It seems to be: 好像是:

brew install pyqt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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