differentiate mkvirtualenv and mkproject for virturalenvwrapper
Asked Answered
W

1

6

I am talking about Doug Hellman's virtualenvwrapper. Well, as per him, once we install virtualenvwrapper, we should edit the .bashrc file as explained here

what we do is we add the following three lines of code:

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

where .virtualenv is the directory where the venvs would be placed. Devel is the directory where the code will reside.

Observation 1: when i do mkvirtualenv proj1 what happens is a directory called proj1 is created inside .virtualenv but NOT inside Devel.

Observation 2: When i do mkproject proj1, a directory inside .virtualenv as well as inside Devel is created.

Now the questions:

  1. Please explain observation 1.

  2. What if two project have same requirements and i want to use a single env and would not want to start with creating another virtualenv and re install the same thing that is installed. How do i do this?

Wilkie answered 21/3, 2012 at 19:59 Comment(1)
Similar question here #8288797Blackface
H
5
  1. This is expected behaviour. The command mkvirtualenv creates a virtual environment but it does not create a project for you. Some people do web development with Django, others do scientific programming in Python so it would be too broad for mkvirtualenv to setup something for you. You can simply create a directory yourself if you're starting a new project.

  2. If both projects are in different directories, you can activate the virtual environment and then navigate to either project directory to work on that. You can then also execute the code of each project while you're in that virtual environment. This way you don't need to reinstall the requirements again in a new virtual environment.

Hartung answered 21/3, 2012 at 20:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.