Member-only story
Journey to Explore Generative AI
The Right Way to Run Python Locally
Experiment Python Without Messing Up Your Machine Environment
The following is helpful if you’re new to Python and running it for the first time. I initially did it the wrong way and hope you can learn from my experience.
The first time I tried running a Python script, I simply used pip install
for all the required packages. This ended up cluttering my machine with packages I only needed once.
Now, I’ve learned that I can create a temporary virtual environment specific to a project. This way, I can install only the necessary packages for that project and exit the environment once I’m done.
Setting Up Python Virtual Environment
1. Setting It Up
First, get into the python project, and setup the Python Virtual Environment.
python3 -m venv <VirtualName>
This will create the <VirtualName>
folder in the python project, storing all the needing Python packages for the work