Skip to content

Instantly share code, notes, and snippets.

@dgkim5360
Last active October 14, 2017 02:43
Show Gist options
  • Save dgkim5360/1219c72793d940b1a3c7e9a68d6b621f to your computer and use it in GitHub Desktop.
Save dgkim5360/1219c72793d940b1a3c7e9a68d6b621f to your computer and use it in GitHub Desktop.
sample scripts and outputs for virtualenvwrapper in Ubuntu
sudo apt install virtualenv
sudo apt install virtualenvwrapper
# if workon does not work, try restarting the terminal
workon # no existing virtual environments (c.f. lsvirtualenv)
mkvirtualenv --python=$(which python) myfirst # init Python 2 virtualenv
#New python executable in /home/don/.virtualenvs/myfirst/bin/python
#Installing setuptools, pip, wheel...done.
# === (myfirst) $ prompt begins
pip list # check it is empty
#DEPRECATION: ...
#pip (9.0.1)
#setuptools (36.5.0)
#wheel (0.30.0)
deactivate # exit
# === (myfirst) $ prompt ends
mkvirtualenv --python=$(which python3) myfirst-py3 # init Python 3 virtualenv
# === (myfirst-py3) $ prompt begins
pip list
#DEPRECATION: ...
#pip (9.0.1)
#setuptools (36.5.0)
#wheel (0.30.0)
workon myfirst # switch
# === (myfirst-py3) $ prompt ends
# === (myfirst) $ prompt begins
add2virtualenv . # add path
#Warning: Converting "." to "/home/don"
add2virtualenv # confirm the added path
#Usage: add2virtualenv dir [dir ...]
#
#Existing paths:
#/home/don
add2virtualenv -d . # remove path
#Warning: Converting "." to "/home/don"
add2virtualenv # check empty again
#Usage: add2virtualenv dir [dir ...]
#
#Existing paths:
deactivate
# === (myfirst) $ prompt ends
workon # show the list of available virtualenvs c.f., lsvirtualenv
#myfirst
#myfirst-py3
rmvirtualenv $(workon) # remove all virtualenvs
#Removing myfirst...
#Removing myfirst-py3...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment