无法在Linux上构建PYQT

时间:2014-06-08 16:15:49

标签: python linux pyqt pyqt4 redhat

我正在使用redhat 6上的pyqt4构建python2.7。我已经从源代码安装了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 />

感谢您的帮助。 - 马克

1 个答案:

答案 0 :(得分:1)

和你一样有问题。被告知我们应该使用&#39; configure-ng.py&#39;相反,但是当我运行时出现这个错误:

    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+(虽然错误消息没有说明)。我使用这些存储库(在CentOS 6上工作)安装了Qt 4.8:https://lists.fedoraproject.org/pipermail/fedora-kde/2013-March/012437.html

添加了这些回购后,我刚刚 yum install qt qt-devel ,它将我的Qt从4.6升级 - &gt; 4.8

在本地获取Qt 4.8后,cd到PyQt4源文件并:

    1. python configure-ng.py
    2. make
    3. make install

EDIT2:原来我们需要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步骤。