Asked By – Jim
I’m confused as to where I should put my virtualenvs.
With my first django project, I created the project with the command
django-admin.py startproject djangoproject
I then cd’d into the djangoproject directory and ran the command
which created the virtual environment directory at the same level as the inner
Is this the wrong place in which to create the virtualenv for this particular project?
I’m getting the impression that most people keep all their virtualenvs together in an entirely different directory, e.g.
~/virtualenvs, and then use virtualenvwrapper to switch back and forth between them.
Is there a correct way to do this?
Now we will see solution for issue: Where should virtualenvs be created?
Many people use the virtualenvwrapper tool, which keeps all virtualenvs in the same place (the
~/.virtualenvs directory) and allows shortcuts for creating and keeping them there. For example, you might do:
and then later:
It’s probably a bad idea to keep the virtualenv directory in the project itself, since you don’t want to distribute it (it might be specific to your computer or operating system). Instead, keep a requirements.txt file using pip:
pip freeze > requirements.txt
and distribute that. This will allow others using your project to reinstall all the same requirements into their virtualenv with:
pip install -r requirements.txt
This question is answered By – David Robinson
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0