Skip to content

Instantly share code, notes, and snippets.

@ahoy-jon
Created April 15, 2015 14:09
Show Gist options
  • Save ahoy-jon/ec8ef5c4eac95313bd74 to your computer and use it in GitHub Desktop.
Save ahoy-jon/ec8ef5c4eac95313bd74 to your computer and use it in GitHub Desktop.
I wanted to use python as I use my Clojure
import sys
if not hasattr(sys, 'real_prefix'):
#we need a virtualenv activated env.
raise NameError('Not in virtualenv')
from subprocess import call, check_output
import os
def install(prog):
my_env = dict(os.environ, PATH=os.environ.get('VIRTUAL_ENV') + "/bin:" + os.environ.get('PATH'))
return check_output(["pip install " + prog], env=my_env, shell=True)
install("sqlalchemy")
import sqlalchemy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment