I have created a virtual environment for django using cmd
pip install virtualenvwrapper-win
mkvirtualenv test
and here I have installed Django using
pip install django
But suppose I close my cmd prompt and restart it. What is the command to re-enter in the (test) environment that I have created.
If you are using the package virtualenvwrapper-win
, then you can use the options described in this part of the docs :
workon [<name>]
If
<name>
is specified, activate the environment named<name>
(change the working virtualenv to<name>
). If a project directory has been defined, we will change into it. If no argument is specified, list the available environments. One can pass additional option-c
after virtualenv name to cd to virtualenv directory if no projectdir is set.
To reactivate the virtual environment: Virtualenvname\Scripts\activate.bat Eg:testing\Scripts\activate.bat This will opens your virtual environment to use.
To create a virtual environment open command prompt/terminal and navigate to the directory where you want to create your Django project. Let's say we want to create our project at 'user/hp/' then we'll navigate to the 'user/hp/' and then type the command below.
Install the virtual environment
Create a virtual environment
C:\Users\hp\mkvirtualenv jangoProject
To activate env type the below command.
C:\Users\hp\jangoProject\Scripts\activate
To deactivate env type the below command
To create a new project type below code
C:\User\hp\django-admin startproject learn1
to re entering the same virtual environment created earlier one should firstly change to the directory where virtual environment is created using the CD(directory). and later change in to the project directory and then change to SCRIPTS and at that moment use the command ACTIVATE to activate the virtual environment.
steps:
follow the above steps to reactivate virtual environment.
To activate previously created environment, just type the following command in your anaconda prompt:
conda activate 'name_of_the_environment'
Voila. You are now on your virtual environment.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.