Minimalistic Python virtual environment cheatsheet
A minimalistic cheatsheet containing the basics of working with Python virtual environments
Install
Installing virtual environments
$pip install virtualenv
Usage
Creating environment
# Create virtual environment
$virtualenv env_name
# Or, preferable way
python3 -m venv /path/to/new/virtual/environment
Before working with the environment, you must activate it.
# Activate virtual environment
$cd /path/to/environment
$source ./bin/activate
# Or
$. ./bin/activate
Once the virtual environment is activated, the name of your virtual environment will appear on the left side of the terminal. This will let you know that the virtual environment is currently active.
From now on, you can install packages
(virtualenv_name)$ pip install package_name
Once you are done with the work, you can deactivate the virtual environment by the following command:
(virtualenv_name)$ deactivate
- keywords: #dev #code #programming #python #pythondev #venv #pip
- image credits: https://openclassrooms.com/