Last active
February 9, 2021 11:44
-
-
Save fastzombies/42829c13d5366324044cd9ed908c521c to your computer and use it in GitHub Desktop.
Step 0 in getting python3 virtualenv going. Just for my reference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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