Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Step 0 in getting python3 virtualenv going. Just for my reference.
#!/bin/bash
# http://www.pythonforbeginners.com/basics/how-to-use-python-virtualenv/
# this gives us python 2.7
#virtualenv env ./env
# start venv like this
mkdir env && cd env
virtualenv -p python3 --no-site-packages env .
# decide if you want to work in activated venv or use full paths for everything
use_venv=0
if [[ ${use_venv} == 1 ]]; then
vpath=''
source bin/activate
else
vpath='bin/'
fi
# now we are in active venv and can install some local packages
${vpath}pip install ipython shortuuid django
# see what packages are installed
${vpath}pip freeze
# export package list to recreate elsewhere
${vpath}pip freeze > requirements.pip
# now somewhere else you can
#mkdir env && cd env
#virtualenv -p python3 --no-site-packages env .
#python3 -m pip install -r requirements.pip
# and now you have an identical python environment
# if using activated venv, devativate before you leave
if [[ ${use_venv} == 1 ]]; then deactivate; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment