Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Copy system packages into virtualenv
import os
import sys
import shutil
pkgname = sys.argv[1]
venv = sys.argv[2]
pyversion = '%s.%s' % (sys.version_info[0], sys.version_info[1])
pkgobj = __import__(pkgname)
except Exception as e:
print e
pkgdir = os.path.dirname(pkgobj.__file__)
dst = '%s/lib/python%s/site-packages/%s' % (venv, pyversion, pkgname)
shutil.copytree(pkgdir, dst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment