In video number 23 of the Coding in Python series, you’ll be introduced to the concept of Virtual Environments.
Commands Used in this Video
Install the required packages
sudo apt install python3-virtualenv
Create a virtual environment
virtualenv -p /usr/bin/python3 my-project
Activate the virtual environment
Change directory into the folder:
cd my-project
source bin/activate
Notice that your Python binary has changed
which python
which python3
Check Python version, to ensure using Python 3
python --version
Deactivate a virtual environment
deactivate
Using pip to install a package
pip install Flask
Listing packages installed via pip
pip list
Uninstalling a pip package
pip uninstall Flask