无法在Linux上构建PYQT
我正在红帽6系统上用 python2.7
构建 pyqt4
。我已经从源代码安装了 python2.7
,其他的东西都能正常工作。当我运行 python2.7 configure.py
时,出现了以下错误:
\# python2.7 configure.py
正在确定你的 Qt 安装的布局...
错误:无法确定你的 Qt 安装的布局。请尝试使用 --verbose
参数重新运行,以查看更多关于问题的细节。
我了解到解决这个问题的方法是输入以下命令,这似乎有效:
\# python2.7 configure.py --qmake /usr/bin/qmake-qt4 -g
这个步骤成功完成了。但是当我运行 make 时,又出现了以下错误。
make[1]: Entering directory /root/Downloads/PyQt-x11-gpl-4.11/qpy<br />
make[2]: Entering directory /root/Downloads/PyQt-x11-gpl-4.11/qpy/QtCore<br />
g++ -m64 -Wl,-O1 -o w_qpycore -lQtGui -lQtCore -lpthread<br />
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o:<br />
In function _start: (.text+0x20): undefined reference to main<br />
collect2: ld returned 1 exit status<br />
make[2]: [w_qpycore] Error 1<br />
make[2]: Leaving directory /root/Downloads/PyQt-x11-gpl-4.11/qpy/QtCore<br />
make[1]: \*\*\* [all] Error 2<br />
make[1]: Leaving directory /root/Downloads/PyQt-x11-gpl-4.11/qpy<br />
make: \*\*\* [all] Error 2<br />
谢谢大家的帮助。 - Mark
1 个回答
我也遇到了和你一样的问题。有人告诉我应该用'configure-ng.py',但是我运行的时候出现了这个错误:
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
An internal error occured. Please report all the output from the program,
including the following traceback, to support@riverbankcomputing.com.
Traceback (most recent call last):
File "configure-ng.py", line 2816, in <module>
main(sys.argv)
File "configure-ng.py", line 2780, in main
target_config.from_introspection(opts.verbose, opts.debug)
File "configure-ng.py", line 695, in from_introspection
self.qt_shared = (lines[1] == 'shared')
IndexError: list index out of range
编辑 -- 我搞明白了。
原来我本地安装的是Qt 4.6,而安装程序需要Qt 4.7以上的版本(虽然错误信息没有说明这一点)。我通过这些源安装了Qt 4.8(在CentOS 6上可以用):https://lists.fedoraproject.org/pipermail/fedora-kde/2013-March/012437.html
添加了这些源后,我只需运行yum install qt qt-devel,就把我的Qt从4.6升级到了4.8。
在本地安装了Qt 4.8后,进入PyQt4的源文件目录,然后:
1. python configure-ng.py
2. make
3. make install
编辑2:结果发现我们工作需要Qt 4.7。经过一些研究,发现这些版本可以一起使用:
PyQt 4.10.4
SIP 4.15.4
QT 4.7.4
Qt 4.7的RPM包可以在这里找到:http://joseph.freivald.com/linux/2011/09/23/qt-4-7-4-and-qt-creator-2-3-0-for-centosrhel-5/
PyQt 4.11和Qt 4.7不兼容(至少对我来说,我用的是CentOS 6.4)。有了这些版本,只需按照上面的1,2,3步骤操作即可。