Forums

"command not found" when running "workon" from within bash script

Hi,

I have website hosted on PythonAnywhere and I created a bash script that contains all the commands I need to run to update it. All of the commands seem to work except the "workon" command I use to start the virtualenv.

How can I activate the virtualenv from within a bash script?

I only need the virtualenv for one command (pip install -r requirements.txt), so if there's an inline(?) solution for running the virtualenv for that one command, that would also work.

Fixed it myself by adding "source virtualenvwrapper.sh" to the bash script above where I call "workon", as described in this answer.

Thank you, Nathan. This worked for me too.