1.3 KiB
1.3 KiB
Apparently venv is the way that Python suggests (Python’s venv
module ) to create virtual environments. This module is part of Python’s standard library, and it’s the officially recommended way to create virtual environments since Python 3.5.
Note: There are other great third-party tools for creating virtual environments, such as conda and virtualenv. Any of these tools can help you set up a Python virtual environment.
For basic usage, venv
is an excellent choice because it already comes packaged with your Python installation. With that in mind, you’re ready to create your first virtual environment.
Create a virtual environment
To make a new virtual environment with venv
simply:
- head to your project folder or make one
mkdir project_folder # this makes a project folder
cd project_folder # head to your project folder
- create a new venv environment
python -m venv env_name
- activate the environment
source env_name/bin/activate
- deactivate when done
deactivate