Home » Linux » Virtualenv: workon command not found

Virtualenv: workon command not found

Posted by: admin November 30, 2017 Leave a comment

Questions:

I have installed virtualenv and the virtualwrapper via apt-get, I got to a point where I created a virtual enviroment but however later on during that same day when I used the workon command it was not found. I further on went and inspected my home directory and .virtualenvs dir and the virtualenv I created earlier were still there …any help would be appreciated. Thanks in advance.

Answers:

Solving this problem took two steps:

Add this to your .bashrc / .bash_profile / .zshrc:

# load virtualenvwrapper for python (after custom PATHs)
venvwrap="virtualenvwrapper.sh"
/usr/bin/which -s $venvwrap
if [ $? -eq 0 ]; then
    venvwrap=`/usr/bin/which $venvwrap`
    source $venvwrap
fi

Then use:

source .bash_profile
# or .bashrc / .zshrc

to reflect the changes.

Additionally, if the terminal still sometimes cant find workon, use source .bash_profile to reset and find it again.

Questions:
Answers:

Read the readme in the top of which virtualenvwrapper.sh
You need to source it inside bashrc

Questions:
Answers:

type source .profile in home directory from terminal.

Leave a Reply

Your email address will not be published. Required fields are marked *