user2522955
user2522955

Reputation: 511

Virtualenv: workon command not found

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.

Upvotes: 50

Views: 85599

Answers (5)

grand central
grand central

Reputation: 49

I ran in to this problem too and I simply needed to logout and log back in. This read in the changes which the debian package manager made to my system at /etc/bash_completion.d/virtualenvwrapper

Upvotes: 1

agconti
agconti

Reputation: 18103

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.

Upvotes: 65

ofir_aghai
ofir_aghai

Reputation: 3321

open ~/.profile

cd ~
nano .profile

add at the end

#virtualenvwrapper setup
export WORKON_HOME=$HOME/envs
export PROJECT_HOME=$HOME/dev
source /usr/local/bin/virtualenvwrapper.sh

to load your .profile file you just edited:

$ . .profile

Upvotes: 11

achabacha322
achabacha322

Reputation: 651

type source .profile in home directory from terminal.

Upvotes: 17

eran
eran

Reputation: 6921

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

Upvotes: 16

Related Questions