Skip to content

Instantly share code, notes, and snippets.

@fastzombies
Last active February 9, 2021 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fastzombies/42829c13d5366324044cd9ed908c521c to your computer and use it in GitHub Desktop.
Save fastzombies/42829c13d5366324044cd9ed908c521c to your computer and use it in GitHub Desktop.
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