Introduction
When starting Python for AI/ML on Windows, many beginners face setup issues such as Python not being detected in CMD/PowerShell, or VS Code running the wrong interpreter. In this article, I will show a clean setup that works for beginners.
Problem Statement
Common errors include:
python --version shows Python was not found
Windows redirects to the Microsoft Store
Python is installed, but pip or sklearn fail
VS Code runs global Python instead of .venv
What We Will Learn
By the end, you will have:
Python installed correctly
VS Code is configured properly
Virtual environment (.venv) created and activated
Packages installed inside .venv
Prerequisites
Windows 10/11
VS Code installed
Internet connection
Step-by-Step Setup
Step 1: Check Python Version
Open PowerShell and run:
python --version
If you see:
Python was not found; run without arguments to install from the Microsoft Store...
It means Windows is using a Microsoft Store alias.
Step 2: Check Python Path
Run:
where python
If output contains:
...\Microsoft\WindowsApps\python.exe
This is the alias shortcut.
Step 3: Install Python Correctly
Download Python from the official Python website and install it.
During installation, make sure to select:
✅ Add Python to PATH
✅ Install pip
Step 4: Verify Installation
Close the terminal and open it again, then run:
python --version
pip --version
Step 5: Create a Project Folder
Example:
D:\Practical\AI_ML\Python\Practical_1
Open this folder in VS Code:
File → Open Folder
Step 6: Create Virtual Environment
In the VS Code terminal:
python -m venv .venv
Step 7: Activate Virtual Environment
Run:
.\.venv\Scripts\activate
You should see:
(.venv)
Step 8: Install Packages
Run:
pip install pandas scikit-learn
Step 9: Configure VS Code Interpreter
This is the most important step.
Press:
Ctrl + Shift + P
Search:
Python: Select Interpreter
Select:
..venv\Scripts\python.exe
Code (First Program)
Create hello.py:
def greet(name):
return f"Hello, {name}!"
if __name__ == "__main__":
print(greet("World"))
Run:
python hello.py
Output
Expected output:
Hello, World!
GitHub Repo Link
My AI/ML learning practicals:
https://github.com/pramodsingh-ai/ai-ml-python-practicals
Summary
In this article, we learned how to set up Python properly on Windows, configure VS Code, and create a virtual environment. This setup avoids the most common beginner issues and ensures that projects use an isolated environment for package management.