How to Set up Virtual Environment using Python pip on Windows OS


Make sure Python3 is installed in your system

Step1: Install pip using python3 

            >python3 -m pip install pip

            >python3 -m pip --version    #Verify the pip version

Step2: Install virtualenv

            >pip install virtualenv

Step3: Create the virtual environment for your project

          project1>virtualenv <your-virtual-env-name>   

          # Eg. >virtualenv myenv --> folder name myenv will get created    

Step4: Activate the virtual environment before you start working on your project

           Linux/macOS --> $source myenv/bin/activate

           Windows        --> >myenv\Scripts\activate.bat  

You should see the name of your virtual environment in brackets on your terminal line like this --> (myenv)



       

Eg: (myenv) C:\Users\..\..\..\projectname\venv\Scripts>    

Step5: To deactivate the virtual environment and use your original Python environment, simply type ‘deactivate’ at that location --> myenv/Scripts/

            >myenv/Scripts/deactivate.bat

     $source myenv/Scripts/deactivate

Post a Comment

Previous Post Next Post