PyQt5 - python-3.2:没有模块可用+ pyuic5找不到PyQt5.uic模块


2

试图安装PyQt5,''make install''命令通过发出与pyuic5文件格式相关的警告而结束(参见下文)

python路径设置为

PYTHONPATH=/usr/lib/python3.2/site-packages/PyQt5

在测试时我会遇到这些问题

找不到模块

help('modules')

不显示任何PyQt5模块

转换错误

试图将.ui文件转换为python模块

$  pyuic5 mywindow.ui -o mywindow_ui.py

结果是

/usr/bin/python3: No module named PyQt5.uic

无法转换UI或嵌入的QT资源(pyrcc5作为pyuic5失败)

建立

随着/usr/lib/python3.2/site-packages目录内容的增加,构建似乎是成功的

/usr/lib/python3.2/site-packages/PyQt5$ ls
__init__.py               QtNetwork.so       QtSql.so
_QOpenGLFunctions_2_0.so  QtOpenGL.so        QtSvg.so
QtBluetooth.so            QtPositioning.so   QtTest.so
QtCore.so                 QtPrintSupport.so  QtWebKit.so
QtDBus.so                 QtQml.so           QtWebKitWidgets.so
QtDesigner.so             QtQuick.so         QtWebSockets.so
QtGui.so                  QtQuickWidgets.so  QtWidgets.so
QtHelp.so                 QtSensors.so       QtX11Extras.so
QtMultimedia.so           QtSerialPort.so    QtXmlPatterns.so
QtMultimediaWidgets.so    Qt.so              uic

建筑环境

  • debian 7.5(wheezy)
  • python3.2标准包
  • SIP 4.16.1来自消息来源
  • Qt5.3位于〜/ Qt / 5.3 / gcc_64
  • PyQt5来源

构建序列

在提取的PyQt5源目录中

$ python3 configure.py --qmake /home/jeby6372/Qt/5.3/gcc_64/bin/qmake
$ make
$ sudo make install

制作安装日志

make[1]: Entering directory `/home/jeby6372/pack/PyQt-gpl-5.3/pyrcc'
install -m 755 -p "pyrcc5" "/usr/bin/pyrcc5"
strip "/usr/bin/pyrcc5"
make[1]: Leaving directory `/home/jeby6372/pack/PyQt-gpl-5.3/pyrcc'
install -m 644 -p /home/jeby6372/pack/PyQt-gpl-5.3/__init__.py /usr/lib/python3.2/site-packages/PyQt5/
cp -f -R /home/jeby6372/pack/PyQt-gpl-5.3/pyuic/uic /usr/lib/python3.2/site-packages/PyQt5/
install -m 755 -p /home/jeby6372/pack/PyQt-gpl-5.3/pyuic5 /usr/bin/
strip /usr/bin/pyuic5
strip:/usr/bin/pyuic5: File format not recognized
make: [install_pyuic5] Error 1 (ignored)

有什么想法解决这个问题?


PyQt5肯定不适用于python-3.2。我发现Windows安装需要python-3.4.0。从源代码安装python-3.4.1并将/path/to/python3.4.1/lib/python3.4/site-packages添加到linux上的python路径解决了这个问题。
Emmanuel 2014年

Answers:


1

make:[install_pyuic5]错误1(忽略)

只是忽略它。你的安装很好。开放式终端:

$python
>>> import PyQt5.Qt

如果没有出现错误,你就完成了。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.