Python - How-to Create Virtual Environment in

Опубликовано: 24 Март 2026
на канале: PythonMaestro
28
3

In this video we will learn how you can use different versions of python for different projects using lightweight python module venv based on installed python versions in your system.

While creating a new virtual environment you must use path to the installed version of python as following in your command line terminal:

/path/to/installed/version/of/python -m venv /path/to/project/directory/venv

Above command will create new python virtual environment into your /path/to/project/directory and directory name will be venv (you use any valid directory name as a virtual environment directory, here we have used venv (convention only).

To activate the newly created virtual environment, type following command in your terminal:

For Mac OS
$ source /path/to/project/directory/venv/bin/activate

For Windows (command prompt):
path\to\project\directory\venv\Scripts\activate.bat

For more information about python venv module, please refer to following:
https://docs.python.org/3/library/venv.html

#python #virtualenvironment #pythontutorial