Still Not Using venv? You're Breaking Your Python Setup. 🔥
Stop installing packages globally. Use venv
to create isolated environments for each project. Here's how, in 30 seconds.
Aaron Rose
Software Engineer & Technology Writer
PSA for my Python devs: If your workflow is pip install <package>
, you're doing it wrong. Here's why. 👇
Mixing all your projects' packages in one global Python install is a recipe for "it works on my machine" disasters. Version conflicts. Broken apps. A crashed system Python. 😵
The fix? Virtual environments (venv
). It's an isolated bubble for each project with its own tools and libraries. Here's the 30-second setup:
1. Create it (in your project folder):
python -m venv .venv
2. Activate it:
Mac/Linux:
source .venv/bin/activate
Windows (CMD or PowerShell):
.venv\Scripts\activate.bat
See the (.venv)
in your terminal? That's the magic.
3. Install stuff safely:
(.venv) pip install pandas numpy flask # only installs here
Pro-Tip 🧠: Keep your project folders clean! Store all environments in a central spot:
Mac/Linux:
python -m venv ~/envs/my_project_venv
source ~/envs/my_project_venv/bin/activate
Windows:
python -m venv %USERPROFILE%\envs\my_project_venv
%USERPROFILE%\envs\my_project_venv\Scripts\activate.bat
Why bother?
- ✅ No more version conflicts between projects.
- ✅ Your
requirements.txt
actually works. - ✅ You'll never break your system OS again.
This isn't optional. It's Python 101. If you're not doing this, you're making your life harder than it needs to be.
Your Homework: Next script you write, run python -m venv .venv
first. Thank yourself later. 💯
Stay isolated, friends. ✌️
Aaron Rose is a software engineer and technology writer at tech-reader.blog and the author of The Rose Theory series on math and physics.
Comments
Post a Comment