Where should virtualenvs be created?

前端 未结 5 1269
情深已故
情深已故 2020-11-28 01:31

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 startproj         


        
5条回答
  •  我在风中等你
    2020-11-28 02:17

    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:

    mkvirtualenv djangoproject
    

    and then later:

    workon djangoproject
    

    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
    

提交回复
热议问题