How to Activate Python Virtual Environment after Deactivating Anaconda in Microsoft Windows

Posted on


Actually, this article is the continuation of the previous article. There are two previous article which have a connection with this one. The first one is an article with the title of ‘How to Create Python Virtual Environment from Anaconda in Microsoft Windows’ in this link. The second one is an article in this link with the title of ‘How to Deactivate Anaconda Prompt available in the Command Prompt in Microsoft Windows’.

  1. First of all, there is already a python virtual environment exist by creating it using a python available in the Anaconda Prompt. It exist in the article in this link. So, there is a python virtual environment exist in form of a folder with the name of ‘env’ as follows :

    (base) C:\training\django-training>dir 
     Volume in drive C is Windows-SSD 
     Volume Serial Number is CA30-19A4 
     Directory of C:\training\django-training 05/03/2022 10:32 AM <DIR> . 
     04/23/2022 10:28 PM <DIR> .. 
     05/03/2022 10:32 AM <DIR> env 
     0 File(s) 0 bytes 3 Dir(s) 219,817,283,584 bytes free 
    (base) C:\training\django-training>
  2. In order to activate the python virtual environment which the representation exist in the ‘env’ folder, just access the following folder exist in the ‘env’ folder :

    (base) C:\training\django-training>conda deactivate
    (base) C:\training\django-training>cd env
    (base) C:\training\django-training\env>cd Scripts
    (base) C:\training\django-training\env\Scripts> activate
  3. It is possible to activate a python virtual environment in the Anaconda prompt as follow :

    (base) C:\training\django-training\env\Scripts>activate
    (env) (base) C:\training\django-training\env\Scripts>
    (env) (base) C:\training\django-training\env\Scripts>
  4. Next, actually it is possible to enable another python virtual environment.

    (env) C:\training\django-training\env\Scripts>

Activate Python Virtual Environment in Anaconda Prompt

In this case, the normal condition will be deactivate the python virtual environment in Anaconda Prompt. After that, it will then continue on to activate the python virtual environment. So, the following are the sequence of the steps :

  1. First of all, just execute the command ‘conda deactivate’. It is a command for deactivating the python virtual environment in Anaconda prompt as follows :

    (base) C:\training\django-training>conda deactivate
  2. The next one, it will be activate the python virtual environment. Just access the folder where the script available. That folder is the newly created python virtual environment with the name of ‘env’. In the ‘env’ folder, just access the folder with the name ‘Scripts’. In order to activate the python virtual environment, just run ‘activate’ as follows :
    (base) C:\training\django-training>cd env
    (base) C:\training\django-training\env>cd Scripts
    C:\training\django-training\env>cd Scripts
    (env) C:\training\django-training\env\Scripts>

As in the output of the last command execution, the activation of the python virtual environment is a success.

Leave a Reply