pyqt在mac osx雪豹中安装问题

发布于 2024-08-07 21:06:08 字数 672 浏览 7 评论 0原文

我正在学习制作桌面应用程序的教程。使用python和qt4,我下载并安装了qt Creator ide,创建了.ui文件,然后我必须使用pyuic4对其进行转换,我已经尝试了很多东西但仍然无法做到。

我以为 pyuic4 会与 Qt Creator IDE 一起安装,但似乎并非如此,所以我通过 macports 安装了 pyqt:

sudo port install py26-pyqt4

我不知道,但那是 qt 附带的,所以构建它大约花了 3 个小时。

安装后我尝试再次转换.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

没有名为 PyQt4 的模块?这不是我刚刚安装的吗?

谢谢,如果我的英语不是 100% 好,请原谅。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

缱绻入梦 2024-08-14 21:06:09

我已经解决了这个问题,你必须使用macports的python而不是OS X自带的默认Python,才能通过macports安装python_select:

sudo port install python_select
sudo python_select python26

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
甜`诱少女 2024-08-14 21:06:09

我做了 一些关于在 Mac Snow 上构建和安装 PyQt4 的说明豹子

顺序很重要,而且 64 位库有一些怪癖。默认的 Mac Qt 库是 Carbon(32 位),而 Mac 系统 Python 是 64 位,需要 Cocoa 库。

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.

疏忽 2024-08-14 21:06:09

我花了一段时间在 Homebrew 中查找包名称。似乎是:

brew install pyqt

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

brew install pyqt
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文