Thursday, August 7, 2025

Python setup on Windows and Visual Code

1. Check Add/Remove programs on Windows to check installed version of Python, uninstall older version 

2. Install Python for Windows from python.org, Check Add python to path 

3. Verify py -3 --version 

4. Install VS Code 

5. Install Microsoft's extension for Python (Intellisense, linting) 

6. Select python interpreter for VS Code Ctrl-Shift-P to select Python interpreter in VS Code python: Interpreter 

7. pip included in python. Used to install packages. 

8. venv - isolated environment for a project for libraries and dependencies. Do not install packages globally

# inside the Python project folder 
python -m venv venv 

# activate 
venv\Scripts\activate 

# check packages installed in venv 
pip list 

# install packages. 
pip install requests 

# save dependencies to file 
pip freeze > requirements.txt 

# install from requirements 
pip install -r requirements.txt