问题
I am trying to install PyQT4 in a virtualenv. I am running Python3.2.1.
Here's what I've done so far:
sudo apt-get install qt4-dev-tools
this worked fine
I downloaded PyQt-x11-gpl-4.9.5 and sip-4.14
Inside the virtualenv I installed sip. No errors came up.
When I try to call:
python3.2 configure.py
for my PyQt it lets me accept the licence, does a bunch of stuff without errors then says:
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.
As far as I can tell my issue is coming from the fact that I'm running the wrong version of Qt. I'm not so sure how to check my Qt version but I have QtAssistant installed and it refers to Qt4.8 so I assume I have that one.
So if it is a version issue:
1. how do I reliably check what version of Qt I'm running?
2. What version should I be running
Otherwise:
1. Wtf?
Any assistance will be greatly appreciated.
PS
I have looked at How to configure PyQt4 for Python 3 in Ubuntu? already. Nothing there helps me.
回答1:
I always install all these libs before installing 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
You can verify qt version by:
qmake --version
Other than that I don't see any problems, I posted this as answer just because the library list can't fit into a comment nicely... Oh and one other thing, you should compile and install sip first, and after that PyQt4
回答2:
It seems the problem is a bug in configure.py file. To solve it simply make sure PyQt source files are located in a path without spaces.
See here for more info: How to install PyQt on Mac OS X 10.6
来源:https://stackoverflow.com/questions/12933997/installing-pyqt4-in-a-virtualenv