在Mavericks上安装PyQt5

2 投票
1 回答
2203 浏览
提问于 2025-04-18 06:23

我正在我的Mavericks电脑上安装PyQt5。

我试着按照这个链接里的方法来做:在OS X上用Python 3安装PyQt5

当我尝试用brew安装qt5的时候,出现了一个警告:

qt5-5.2.1 already installed

但是当我输入 python configure.py 时,

终端显示:

querying qmake about your Qt installation... Error: PyQt5 requires Qt
v5.0 or later. You seem to be using v4.8.6. Use the
--qmake flag to specify the correct version of quake.

有没有人能帮我解决这个问题?

1 个回答

10

当你通过homebrew安装Qt的时候,应该会看到类似这样的警告:

This formula is keg-only, so it was not symlinked into /usr/local.

Qt 5 conflicts Qt 4 (which is currently much more widely used).

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/qt5/lib
    CPPFLAGS: -I/usr/local/opt/qt5/include

虽然这些信息很有帮助,但你真正需要找的东西在一个目录下,路径是 /usr/local/opt/qt5/$VERSION_OF_QT/bin/,因为 qmake 是一个二进制工具。

对我来说,qmake 的位置是 /usr/local/Cellar/qt5/5.3.1/bin/qmake。把这个路径放到你的 --configure 选项里,你就可以继续了!

比如说,你可以这样写: python configure.py --qmake /usr/local/Cellar/qt5/5.3.1/bin/qmake

撰写回答