Coding in Python 23 – Virtual Environments

In video number 23 of the Coding in Python series, you’ll be introduced to the concept of Virtual Environments.

Subscribe to LearnLinuxTV

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

Notable Replies

  1. Somebody’s been busy! :wink:

Continue the discussion at community.learnlinux.tv

Participants