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.
            Asked
            
        
        
            Active
            
        
            Viewed 8.4k times
        
    5 Answers
65
            
            
        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.
 
    
    
        agconti
        
- 17,780
- 15
- 80
- 114
- 
                    7Thanks. In Mint 17.x it didn't like the -s on the which so I switched it for -a (which I think corresponds to -s) and now it works. – glaucon Oct 23 '15 at 00:46
- 
                    21I had to use `-a` instead of `-s` as well on Ubuntu. May be the case for Debian-based systems I guess. – Robert Dundon Jan 08 '16 at 19:03
16
            
            
        Read the readme in the top of which virtualenvwrapper.sh
You need to source it inside bashrc
 
    
    
        eran
        
- 6,731
- 6
- 35
- 52
11
            
            
        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
 
    
    
        ofir_aghai
        
- 3,017
- 1
- 37
- 43
1
            
            
        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
 
    
    
        grand central
        
- 49
- 4
 
     
     
    