How To Setup A Python Virtual Environment in Ubuntu 18.04

7 Views
Published
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 < 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 "", line 1, in
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
Category
Liquid Web
Tags
liquidweb, datacenter, web
Be the first to comment