0

I'm trying to understand when is best to use mkproject vs mkvirtualenv when using virtualenvwrapper.

I found a couple of answers of what is the difference between the two here and here.

From the second link, this seems to be the best summary of the differences:

From my understanding of the documentation, mkvirtualenv projectenv simply creates a new virtual environment named projectenv in $WORKON_HOME, while mkproject projectenv creates a new virtual environment named projectenv and a new directory named projectenv; after creation, the projectenv directory automatically becomes your current working directory. The virtual environment will exist in $WORKON_HOME and the development directory exists in $PROJECT_HOME.

When would it be more appropriate to use mkproject and when mkvirtualenv? I would really find an example of the differences useful if possible.

aydow
  • 3,081
  • 1
  • 18
  • 33

1 Answers1

1

mkvirtualenv creates (and activates) just a virtualenv — a python environment that separates libraries from globally installed to prevent your development from messing with system libraries.

mkproject creates (and activates) a virtualenv and a new empty directory in which you will do your development.

If you already done some development and have a directory with source code you still can make it a project: create or activate a virtualenv, change directory to the source code directory and run setvirtualenvproject.

The only advantage of marking a source code directory being a project is that when you activate the environment virtualenvwrapper automatically change directory to the source code directory. And you can do it from the command line with command cdproject.

phd
  • 57,284
  • 10
  • 68
  • 103