Skip to content

Instantly share code, notes, and snippets.

@damianavila
Forked from jlesquembre/postmkvirtualenv
Created September 14, 2013 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damianavila/6558097 to your computer and use it in GitHub Desktop.
Save damianavila/6558097 to your computer and use it in GitHub Desktop.
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment