I\'m using Virtualenv with profit on my development environment with web.py
, simplejson
and other web oriented packages.
I\'m going to develop
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 asked if it's possible to install PySide from within virtualenv on irc.freenode.net #pyside channel and got positive answer from hugopl. So I followed instructions from PySide Binaries for Microsoft Windows and it worked. The output is below.
Z:\virtualenv\pyside>Scripts\activate.bat
(pyside) Z:\virtualenv\pyside>where python
Z:\virtualenv\pyside\Scripts\python.exe
(pyside) Z:\virtualenv\pyside>easy_install PySide
install_dir Z:\virtualenv\pyside\Lib\site-packages\
Searching for PySide
Reading http://pypi.python.org/simple/PySide/
Reading http://www.pyside.org
Reading http://www.pyside.org/files/pkg/
Best match: PySide 1.0.0beta1qt471
Downloading http://www.pyside.org/files/pkg/PySide-1.0.0beta1qt471.win32-py2.6.exe
Processing PySide-1.0.0beta1qt471.win32-py2.6.exe
Deleting c:\users\piotr\appdata\local\temp\easy_install-fvfa7e\PySide-1.0.0beta1qt471-py2.6-win32.egg.tmp\EGG-INFO\scripts\py
ide-uic-script.py
Deleting c:\users\piotr\appdata\local\temp\easy_install-fvfa7e\PySide-1.0.0beta1qt471-py2.6-win32.egg.tmp\EGG-INFO\scripts\py
ide-uic.exe
creating 'c:\users\piotr\appdata\local\temp\easy_install-fvfa7e\PySide-1.0.0beta1qt471-py2.6-win32.egg' and adding 'c:\users\
iotr\appdata\local\temp\easy_install-fvfa7e\PySide-1.0.0beta1qt471-py2.6-win32.egg.tmp' to it
creating z:\virtualenv\pyside\lib\site-packages\PySide-1.0.0beta1qt471-py2.6-win32.egg
Extracting PySide-1.0.0beta1qt471-py2.6-win32.egg to z:\virtualenv\pyside\lib\site-packages
Adding PySide 1.0.0beta1qt471 to easy-install.pth file
Installing pyside-uic-script.pyc script to Z:\virtualenv\pyside\Scripts
Installing pyside_postinstall.py script to Z:\virtualenv\pyside\Scripts
Installing pyside_postinstall.pyc script to Z:\virtualenv\pyside\Scripts
Installing pyside-uic-script.py script to Z:\virtualenv\pyside\Scripts
Installing pyside-uic.exe script to Z:\virtualenv\pyside\Scripts
Installed z:\virtualenv\pyside\lib\site-packages\pyside-1.0.0beta1qt471-py2.6-win32.egg
Processing dependencies for PySide
Finished processing dependencies for PySide
(pyside) Z:\virtualenv\pyside>python Scripts\pyside_postinstall.py -install
Generating file Z:\virtualenv\pyside\Scripts\qt.conf...
The PySide extensions were successfully installed.
Let's assume your virtualenv is named myProject and you're using virtualenvwrapper. A Unix platform is also assumed.
$ workon myProject
$ pip install --no-install SIP
$ pip install --no-install PyQt
$ cd ~/.virtualenvs/myProject/build/SIP
$ python configure.py
$ make
$ make install
$ cd ~/.virtualenvs/myProject/build/PyQt
$ python configure.py
$ make
$ make install
$ cd && rm -rf ~/.virtualenvs/myProject/build # Optional.
If you installed pyqt via brew on a Mac (specifically I'm on Mavericks):
ln -s /usr/local/Cellar/sip/4.15.2/lib/python2.7/site-packages/*.* ~/{VIRTUALENVHOME}/{VIRTUALENVNAME}/lib/python2.7/site-packages
ln -s /usr/local/Cellar/pyqt/4.10.3/lib/python2.7/site-packages/PyQt4/ ~/{VIRTUALENVHOME}/{VIRTUALENVNAME}/lib/python2.7/site-packages/PyQt4
pip install pygments pyzmq
Of course those version folder numbers may change over time.
What worked for me was copying /PyQt4/
and sip.x86_64-linux-gnu.so
from /usr/lib/python2.7/dist-packages
to <VIRTUALENV>/lib/python2.7/site-packages
and changing the ownership permissions on these copied files (since the copies were owned by root).
Try this one: pip install python-qt5