Just install it system wide, see PyQt4 installation procedure
SIP Installation. Download the .tar file then uncompress
tar -xzf
then configure it with
python configure.py --incdir=~/.virtualenv/<virtualenvironmentname>/include/python2.7
make
sudo make install
The path after the configure.py is so SIP links to any virtual enviroments you specifiy. PyQt4 Can then use SIp in these virtual envs.
PYQT4 Ubuntu
sudo apt-get install python-qt4
Put the following in the file ~.virtualenvs/postactivate
This links the PyQt4 library to all virtualenvs when they are activated.
#!/usr/bin/env bash
# This hook is sourced after every virtualenv is activated.
#set -e # abort after any errors
#set -u # exit after accessing an undefined variable
libs=(PyQt4 sip.so sipconfig.py)
python_version=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))")
var=( $(which -a ${python_version}) )
if [ ${#var[@]} -lt 2 ]; then
echo "could not find system install of ${python_version}: unable to link PyQt components" >&2
else
get_python_lib_cmd="from distutils.sysconfig import get_python_lib; print (get_python_lib())"
lib_virtualenv_path=$(${var[0]} -c "${get_python_lib_cmd}")
lib_system_path=$(${var[-1]} -c "${get_python_lib_cmd}")
for lib in ${libs[@]}
do
if [ ! -e "${lib_virtualenv_path}/${lib}" ]; then
ln -s "${lib_system_path}/${lib}" "${lib_virtualenv_path}/${lib}"
fi
done
fi