6

I have virtualenv setup and it is working well accept for one annoying issue. when I use the workon command to enter an environment the environment is logs in correctly but I do not get automatically directed to the environments root directory.

I have added the following lines to my .bashrc file:

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

and reloaded it (source .bashrc), but when I enter an environment I am still left in my ubuntu user home directory. I have also tries restarting my server, but still no luck.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Finglish
  • 9,692
  • 14
  • 70
  • 114

2 Answers2

7

I don't think workon changes to the environment directory. The solution would is to put that in postactivate file of your virtualenv.

E.g. I have following in my <virtual_env_dir>/bin/postactivate

cd /home/myuser/work/
Rohan
  • 52,392
  • 12
  • 90
  • 87
4

Environments are separate from projects with virtualenvwrapper. You first need to ensure that the $PROJECT_HOME variable is set. Then you can use the mkproject command to create an environment and a project in `$PROJECT_HOME'. Alternatively, you can use setvirtualenvproject to associate an existing project with an existing virtual environment.

Casebash
  • 114,675
  • 90
  • 247
  • 350