Gyanteilen

Thoughts on tech and life as an NRI in Germany

If you’re starting a new Python project on Windows 11, there’s a good chance your first 30 minutes will be spent fighting your environment instead of writing code. I’ve been there — these are the exact issues I ran into on Windows 11 and how I fixed each one.


1. Picking the wrong Python version

My first instinct was to install Python 3.11. Turns out 3.11 is now in “security fixes only” mode — 3.11.9 was the last version to ship a Windows .exe installer. Any newer 3.11 security releases only come as source tarballs, which are useless on Windows. That means you’d be stuck on an installer that no longer receives updates.

What I chose: I went with Python 3.13.13 — it had a proper Windows installer and worked well for my needs. You can pick any version that suits your project, just make sure it has a Windows .exe installer available.

Direct download:

https://www.python.org/ftp/python/3.13.13/python-3.13.13-amd64.exe

Which file to download? For most Windows machines, pick Windows installer (64-bit). Only choose ARM64 if you specifically know your device runs on an ARM processor.


2. Microsoft Store hijacking the python command

After installing Python 3.13, I opened a terminal and ran:

python --version

Instead of a version number, Windows helpfully said:

Python was not found; run without arguments to install from the Microsoft Store...

Windows ships with a fake python.exe that opens the Microsoft Store instead of running Python. It sits earlier in the PATH than your real installation.

The fix:

  1. Open Start → search “App execution aliases”
  2. Find python.exe and python3.exe
  3. Toggle both OFF

Then close and reopen your terminal.


3. Python not found at all after toggling off the alias

After disabling the Store alias, I got a different error:

python : The term 'python' is not recognized as the name of a cmdlet...

During Python installation, the installer shows a checkbox on the first screen — “Add python.exe to PATH”. If you select it there, Python is added to your PATH automatically. If you missed it (like I did), you’ll need to fix it manually.

Before jumping to fixes — verify first: Open a new terminal and run:

where python

If Python is in your PATH, it will print the full path to python.exe. If you get INFO: Could not find files for the given pattern(s), it confirms Python is not in your PATH — proceed with one of the options below.

The fix — Option A (easiest): Re-run the installer, choose Modify, and make sure “Add python.exe to PATH” is ticked.

The fix — Option B (manual): Add these two entries to your user PATH via SystemPropertiesAdvanced → Environment Variables → Path → Edit → New:

C:\Users\<yourname>\AppData\Local\Programs\Python\Python313
C:\Users\<yourname>\AppData\Local\Programs\Python\Python313\Scripts

The Scripts\ entry is important — that’s where pip.exe lives.

After either fix, fully close and reopen VS Code — old terminals won’t pick up PATH changes.


4. PowerShell blocking venv activation

Once Python was working, I created a virtual environment:

python -m venv .venv

Then tried to activate it:

.venv\Scripts\Activate.ps1

And got:

cannot be loaded because running scripts is disabled on this system.

Windows PowerShell blocks all scripts by default. This is a security setting called the Execution Policy.

The fix: Run this once in PowerShell:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Type Y when prompted. This setting only changes it for your user account, not system-wide. RemoteSigned means your own local scripts run freely — only scripts downloaded from the internet need to be signed by a trusted publisher. It’s safe for development.

After that, activate normally:

.venv\Scripts\Activate.ps1

You’ll know it worked when you see (.venv) at the start of your prompt.


Final working setup

Here’s the full sequence that works cleanly on Windows:

# 1. Navigate to your project
cd C:\Users\yourname\projects\MyProject

# 2. Create the virtual environment
python -m venv .venv

# 3. Allow scripts (first time only)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# 4. Activate
.venv\Scripts\Activate.ps1

# 5. Install packages
pip install python-dotenv requests ipykernel

# 6. Save your dependencies
pip freeze > requirements.txt

You should see (.venv) in your prompt and python --version should print Python 3.13.13.


Quick reference — symptoms and fixes

Symptom Cause Fix
Opens Microsoft Store Store alias enabled Disable in App execution aliases
python not recognized Not in PATH Re-run installer or add PATH manually
.ps1 cannot be loaded Execution policy blocked Set-ExecutionPolicy RemoteSigned
pip not recognized Scripts folder not in PATH Add \Scripts\ to PATH

These issues are annoyingly common but each one has a one-minute fix. Once your environment is set up correctly, you won’t hit them again.


Questions or comments?

Ask a question, share your experience, or add a correction below.

Loading comments...