Virtualenv - workon command not found
Olivia Zamora
I followed these steps to set up virtualenv + virtualenvwrapper:
$ sudo apt-get install python3-pip
$ sudo pip3 install virtualenv
$ sudo pip3 install virtualenvwrapper
$ mkdir ~/.virtualenvs
$ export WORKON_HOME=~/.virtualenvs
$ VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'
$ source /usr/local/bin/virtualenvwrapper.sh
$ mkvirtualenv venv
$ virtualenv venvSo far it was working fine but I restarted the shell and then I tried workon venv and now it says: command not found
2 Answers
So far it was working fine but I restarted the shell
The reason is because you restarted the shell.
If you want this to work with each shell, you'll need to add these to your ~/.bashrc file:
export WORKON_HOME=~/.virtualenvs
VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'
source /usr/local/bin/virtualenvwrapper.shAfter adding this, you'll want to source ~/.bashrc so the changes take effect. You'll find that you have access to virtualenvwrapper facilities in each new shell.
You need to add commands
export WORKON_HOME=~/.virtualenvs
VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'
source /usr/local/bin/virtualenvwrapper.shto your ~/.bashrc file. So that whenever you start shell these commands are loaded automatically.
For the reference.