Contents
Storage Setup
Create directories to install Python and to save projects. Replace d: with the drive of your choice.
md d:\dev
md d:\dev\python
md d:\dev\python\pyprojects
md d:\dev\python\pyversions
md d:\dev\python\pyversions\py<major & minor version> e.g. py0313 for Python v3.13
Install Python
Download the latest stable version of Python.
- Install python in d:\dev\python\pyversions\py<major & minor version> e.g. py0313 for Python v3.13
Update pip (Preferred Installer Program)
python.exe -m pip install --upgrade pip
pip list
Setup the Virtual Environment
Best practice is to create a separate virtual environment for each project.
cd d:\dev\python\pyprojects
md demo-project
cd demo-project
python -m venv .venv
Activate the Virtual Environment
- cd d:\dev\python\pyprojects\demo-project
- .venv\Scripts\activate
- This sets the path and environment variables for the selected version of Python.
Install a module/library in the Virtual Environment
- (.venv) D:\python\pyprojects\demo-project> pip install numpy
- Or # python -m pip install numpy
Deactivate the Virtual Environment
.venv\Scripts\deactivate
Use requirements.txt
For each project create a “requirements.txt” with the list of dependencies/libraries/packages the project requires.
- # pip install -r requirements.txt
- Anything already installed will be skipped.
Reference
- Python Virtual Environments: A Primer by Martin Breuss
- You MUST WATCH THIS before installing PYTHON by Python Programmer
- The Complete Guide to Python Virtual Environments! by teclado
- Python Virtual Environments – Full Tutorial for Beginners by Tech With Tim
- The BEST No-Nonsense VSCode Setup for Python Devs by ArjanCodes
- Virtual Environments and Packages by Python.org