This question already has an answer here:
I am trying to automate the removal and recreation of a virtualenv on a Mac (Mavericks).
I have a file
./clean_venv.sh: line 3: deactivate: command not found
./clean_venv.sh: line 4: rmvirtualenv: command not found
./clean_venv.sh: line 5: mkvirtualenv: command not found
However, running the commands in the same location works fine. Why is this?
Best How To :
Inspired by this question I've found this code to work:
source `which virtualenvwrapper.sh`
mkvirtualenv temp # This makes sure I'm not on the test virtualenv,
workon temp # otherwise I can't delete it. deactivate doesn't
# work for some reason
pip install -r requirements.txt;
This feels hacky, but it achieves the desired result. After updating
requirements.txt one command can recreate the virtualenv from scratch. At the end I have one virtual env (
temp no longer exists.