When you create a Python application then there is a need to create virtual environment. Virtual environment helps you to maintain your dependencies in an isolated location. This doesn't effect the global system dependencies. Also, using virtual environment you can have python application that supports different version of Python

In this post we will be creating Python3.8 virtual environment


  • Python3.8 must be installed
  • pip must be installed

Step 1 : Find the location of Python Interpreter

  • You need to find the path of Python3.8 interpreter
  • This will depend upon the operating system that you are using

Find Python3.8 Interpreter Path in Linux/Mac Operating System

  • Open you terminal and use below command
whereis python3.8
  • You may get multiple paths, but you have to consider the path that contains bin and python3.8

Find Python3.8 Interpreter Path in Windows Operating System

  • Open the Command Promt and use below commnd
where python3.8
  • You will get the python Interpreter path. Copy the path of interpreter as it will be needed in subsequent steps.

Step 2 : Install virutalenv python package

pip install virtutalenv

Step 3 : Create Virtual environment

  • Goto the directory where you want to create Python3.8 virtutalenv
  • Use below command and replace [path-of-python-3.8-interpreter] with the value obtained in step 1
virtutalenv -p [path-of-python-3.8-interpreter] venv
  • This will create a folder with name venv. All your python packages for a particular application will be installed in their respective venv folder.

Step 4 : Activating the virtual environment

  • Before installing any python package or library you have to activate the virtual environment.

Activate Virtual Environment in Linux/Mac Operating System

sourve venv/bin/activate

Activate Virtual Environment in Windows Operating System


Check Python Version

  • You can also check the Python version using below command
python --version
  • You will get below output
Python 3.8.5

Step 5 : Deactivate virtual environment

  • use the below command to deactivate the virtual environment

Step 6 : Deleting the virtual environment

  • Just remove all the contents from venv folder, and your virtual environment will be deleted.

Happy Coding

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x