How To Setup A Python Virtual Environment in Ubuntu 18.04

Furlow consulting


In this video, we will do a walkthrough of how to set up a virtual environment on Ubuntu.

Commands used:

apt-get update -y
apt-get install -y python3-venv
mkdir awesome_python_project
cd awesome_python_project
python3 -m venv awesome_venv
source awesome_venv/bin/activate
pip install -U setuptools pip
pip install termcolor
cat < <EOF > hello_colors.py

Snippet:
================================
#!/usr/bin/env python

import termcolor

for color in termcolor.COLORS.keys():
    print(termcolor.colored(“Hello!”, color))
EOF
================================

python hello_colors.py
deactivate
python3

 import termcolor:
================================
> > > import termcolor
Traceback (most recent call last):
  File “<stdin>”, line 1, in <module>
ModuleNotFoundError: No module named ‘termcolor’
================================

The related article for this article can be found here: https://www.liquidweb.com/kb/how-to-setup-a-python-virtual-environment-on-ubuntu-18-04/

For more information about this and other topics, visit us at https://www.liquidweb.com/kb/.
For more information on our current specials, visit: https://www.liquidweb.com/products/vps/

Video by: Justin Palmer


Duration: 3:20
Publisher: Liquid Web
You can watch this video also at the source.


Furlow consulting