Last active

Creates a symlink to PyQt libraries when a new virtual environment is created

  • Download Gist
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# This hook is run after a new virtualenv is activated.
# ~/.virtualenvs/postmkvirtualenv
libs=( PyQt4 )
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[@]}
ln -s $lib_system_path/$lib $lib_virtualenv_path/$lib

Under Ubuntu (13.10), this links to /usr/lib/python3.3/site-packages/ and /usr/lib/python3.3/site-packages/PyQt4, which are non-existent. These files are living in /usr/lib/python3/dist-packages/
This is because Debian/Ubuntu installs Python packages into dist-packages, not site-packages.
So the script is not usable under *buntu/Debian

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.