I'm using Virtualenv with profit on my development environment with web.py
, simplejson
and other web oriented packages.
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py.
Does anybody here had succesfully installed PyQt4 with Virtualenv?
Is it possible?
I've downloaded all the binaries and have PyQt4
installed globally on my python2.6 directory.
If I don't use --no-site--packages
option, Virtualenv correctly includes PyQt4
in my new sandbox but, obviously, with all the global packages that I don't need.
Is there a clean way to prepare a new sandbox with --no-site--packages
option and then add PyQt4
or PySide
using pip
, easy_install
or some other magic trick?
It should be enough to create an empty virtualenv and then copy the contents of the .../site-packages/PyQt4
directories into it.
I suggest to install PyQt4 once globally, make a copy of the directory, uninstall it and then use this trick to create VEs.
I have the same problem. I use virtualenvwrapper, so I wrote this script to create a link to PyQt in every new virtual environment. Maybe is useful for someone else:
#!/bin/bash # This hook is run after a new virtualenv is activated. # ~/.virtualenvs/postmkvirtualenv LIBS=( PyQt4 sip.so ) PYTHON_VERSION=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))") VAR=( $(which -a $PYTHON_VERSION) ) GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())" LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD") LIB_SYSTEM_PATH=$(${VAR[-1]} -c "$GET_PYTHON_LIB_CMD") for LIB in ${LIBS[@]} do ln -s $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB done
link to gist
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With