Creating Python Virtual Environment in Windows and Linux Last Updated : 17 May, 2025 Comments Improve Suggest changes Like Article Like Report A Virtual Environment is a Python environment, that is an isolated working copy of Python that allows you to work on a specific project without affecting other projects So basically it is a tool that enables multiple side-by-side installations of Python, one for each project. Creating a Python virtual environment in LinuxStep 1: Ensure Python and pip are installedOn most Linux distributions, Python 3 and pip can be installed via package manager:sudo apt updatesudo apt install python3 python3-pip python3-venStep 2: Create a virtual environmentThis creates a folder myenv (you can use any name) containing the isolated Python environment.python3 -m venv myenvStep 3: Activate the virtual environmentsource myenv/bin/activateYour shell prompt will change to indicate the active environment.Step 4: Deactivate the virtual environmentdeactivateCreating Python Virtual Environment in WindowsIf python is installed in your system, then pip comes in handy. So simple steps are:Step 1: Create a virtual environmentOpen Command Prompt or PowerShell, navigate to your project folder, and run:python -m venv myenvStep 2: Activate the virtual environmentmyenv\Scripts\activateStep 4: Deactivate the virtual environmentSimply run:deactivate Comment More infoAdvertise with us Next Article Creating Python Virtual Environment in Windows and Linux S Shantanu Sharma. Follow Improve Article Tags : Misc Python Practice Tags : Miscpython Similar Reads Create virtual environment in Python A virtual environment is a self-contained directory that contains a Python installation for a particular version of Python, plus a number of additional packages. Using virtual environments is a common practice in Python development as it helps to manage dependencies for different projects, avoiding 3 min read Setting Up a Virtual Environment in Django Setting up a virtual environment in Django is essential for isolating your project's dependencies and ensuring consistent behavior across different environments. A virtual environment allows you to install packages locally without affecting the global Python installation. Here's how to set up a virt 2 min read How to Set Up a Python Virtual Environment in Visual Studio on Windows Creating a Python virtual environment is a fundamental practice for managing dependencies and ensuring project isolation. This guide will walk us through the steps to set up a Python virtual environment in Visual Studio on a Windows machine, providing a solid foundation for our Python project develo 3 min read Using mkvirtualenv to create new Virtual Environment - Python Virtual Environment are used If you already have a python version installed and you want to use a different version for a project without bothering the older ones. it is good practice to use a new virtual environment for different projects. There are multiple ways of creating that, today we will cre 2 min read Managing Virtual environments in Python Poetry Poetry helps you declare, manage, and install dependencies of Python projects, ensuring you have the right stack everywhere. Poetry is a tool for dependency management and packaging in the PHP programming language that helps in managing project dependencies and creating virtual environments. Unlike 4 min read Using Jupyter Notebook in Virtual Environment In this article, we are going to see how to set Virtual Environment in Jupyter. Sometimes we want to use the Jupyter notebook in a virtual environment so that only selected packages are available in the scope of the notebook. To do this we have to add a new kernel for the virtual environment in the 2 min read How to Install VirtualBox in Linux? Virtual Machine abstracts the hardware of our personal computers, such as CPU, disk drives, memory, NIC (Network Interface Card), etc., into many different execution environments as per our requirements, hence giving us a feeling that each execution environment is a single computer. How to Install V 4 min read How to run Linux Commands on Windows 10? It is a dilemma when you want to switch from one operating system to another. This is a common case when you switch from Windows to Linux. Either you store your data and then uninstall Windows to install Linux and then transfer your data or you can have a dual boot system where you encounter an opti 2 min read How to Install VirtualBox on Windows? Virtual Machine abstracts the hardware of our personal computers such as CPU, disk drives, memory, NIC (Network Interface Card), etc, into many different execution environments as per our requirements, hence giving us a feeling that each execution environment is a single computer. For example, Virtu 1 min read Operating system based Virtualization Operating System-based Virtualization is also known as Containerization. It is a technology that allows multiple isolated user-space instances called containers to run on a single operating system (OS) kernel. Unlike traditional virtualization, where each virtual machine (VM) requires its own OS, OS 5 min read Like