


Once in the directory, run “python -m venv ” or “python3 -m venv ” if the first command throws an error.

To create a Python virtual environment in Windows, open the command prompt and navigate to the desired directory using the “cd” command followed by the path. Creating a Virtual Environment in Windows 10 We’ve already covered virtual environments in detail if you are new to the topic. The main objective of using a virtual environment for a particular project is to avoid any sort of disturbance caused related to packages – their installation, versions, etc.Ĭommon installation tools like pip – the Python package manager, will automatically help to install the Python packages into a virtual environment when used from within a virtual environment without being expressly instructed to do so.Ī virtual environment is built on top of an already installed Python installation, this already existing installation serves as the base for the created virtual environments, and it may be separated from the base environment’s packages so that only those specifically installed in the virtual environment are accessible. By using a virtual environment, you may prevent installing Python packages globally, which might disrupt system tools or other projects. Python packages for numerous projects are managed through the virtual environment. What is a Virtual Environment and Why is it Used? Before we start with deploying the virtual environment, we will also look at what exactly is a virtual environment and what is it used for. In this article, we will learn how to create and activate a virtual environment in Windows 10 using the command prompt.
