我正在尝试在 virtualenv 中安装 PyQT4。我运行的是Python3.2.1。
这是我到目前为止所做的事情:
sudo apt-get install qt4-dev-tools
这很好用
我下载了 PyQt-x11-gpl-4.9.5 和 sip-4.14
在 virtualenv 中我安装了 sip。没有出现错误。
当我尝试打电话时:
python3.2 configure.py
对于我的 PyQt,它让我接受许可证,做一堆没有错误的事情,然后说:
Generating the C++ source for the QtCore module...
sip: Usage: sip [-h] [-V] [-a file] [-b file] [-c dir] [-d file] [-e] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag] [-T] [-w] [-x feature] [-X id:file] [-z file] [file]
Error: Unable to create the C++ code.
据我所知,我的问题是由于我运行了错误版本的 Qt。我不太确定如何检查我的 Qt 版本,但我安装了 QtAssistant,它引用的是 Qt4.8,所以我假设我有那个版本。
如果是版本问题:
1. how do I reliably check what version of Qt I'm running?
2. What version should I be running
否则:
1. Wtf?
任何帮助将不胜感激。
附注
我看过How to configure PyQt4 for Python 3 in Ubuntu?已经。那里没有任何东西可以帮助我。
最佳答案
我总是在安装 PyQt4 之前安装所有这些库:
sudo apt-get install libqt4-assistant libqt4-core \
libqt4-dbg libqt4-dbus libqt4-designer libqt4-dev \
libqt4-gui libqt4-help libqt4-network libqt4-opengl \
libqt4-qt3support libqt4-script \
libqt4-svg libqt4-test libqt4-webkit libqt4-webkit-dbg \
libqt4-xml libqt4-xmlpatterns libqt4-xmlpatterns-dbg \
libqtcore4 libqtgui4 qt4-demos qt4-designer qt4-dev-tools \
qt4-doc qt4-doc-html qt4-qtconfig qtcreator libqtwebkit-dev \
qt4-qmake cmake r-base-dev libcurl4-gnutls-dev
您可以通过以下方式验证 qt 版本:
qmake --version
除此之外,我没有看到任何问题,我将其发布为答案只是因为库列表无法很好地适合评论...... 哦,还有一件事,你应该首先编译并安装 sip,然后是 PyQt4
关于python - 在 virtualenv 中安装 PyQt4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12933997/