Python Virtual Environments
Creating virtual environments in 3 seconds (Linux/Mac)

Looking ahead
Prerequisites
Set up
Shell commands
— Install virtual environment
— Create virtual environment
— Activate virtual environment
— Deactivate virtual environment
— List all packages
No matter how many times I go through this process, I always find myself searching the web “How to set up a virtual environment?” then sifting through too many articles to get to the key commands. Is it just me? Anyone else on the same boat?
Here are the list of commands to save you some time.
Prerequisites
- Python 3
Set up
Install virtualenv package using pip (if not already installed)
pip3 install virtualenv
Create your project folder and navigate to that directory.
# create folder called streamlit_test or anything else you'd like
$ mkdir streamlit_test# navigate to that directory
$ cd streamlit_test
Create virtual environment
# create virtual environment called testVenv or anything else you'd like$ python3 -m venv testVenv
Activate virtual environment
You can tell that your virtual environment has been activated when you see (virtual environment name) in your terminal — screenshot below.
# replace testVenv with name of your virtual environment$ source testVenv/bin/activate

Deactivate virtual environment
$ deactivate
View all installed packages
$ pip list

That’s pretty much it. If you are using Pycharm, you can actually create a virtual environment right at the start of your project — amazing built-in feature, would highly recommend.
Now off to explore the Streamlit Cloud deployment process. More to come!