Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases


If you’ve ever tried running python in your Windows command prompt and encountered this error:

“Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.”

You’re not alone. This issue occurs when Python is either not installed, not properly added to the system PATH, or the Windows execution alias interferes with detection.

In this guide, I’ll walk you through the step-by-step process to fix this issue and set up Python correctly on your Windows system.


1. Check If Python is Installed

Before doing anything else, let’s verify whether Python is already installed.

  1. Open Command Prompt (Win + R, type cmd, press Enter).
  2. Run the following command:

where python        

or

where python3        

  • If Python is installed, this command should return a file path like:

C:\Users\YourUsername\AppData\Local\Programs\Python\PythonXX\python.exe        

  • If you see no output or an error, Python is either not installed or not properly configured.


2. Install or Reinstall Python

If Python is missing or needs a fresh install, follow these steps:

  1. Download Python from the official website: Python.org
  2. Run the installer, and make sure to check the box that says: “Add Python to PATH”
  3. Click Install Now and follow the installation steps.


3. Add Python to System PATH Manually (If?Needed)

If you installed Python but it’s still not recognized, you may need to add it to your system’s environment variables.

Step 1: Find Python’s Installation Path

Python is typically installed in one of these locations:

C:\Users\YourUsername\AppData\Local\Programs\Python\PythonXX\
C:\PythonXX\        

(Replace XX with the actual version number.)

Step 2: Add Python to?PATH

  1. Open Run (Win + R), type sysdm.cpl, and press Enter.
  2. Go to the Advanced tab → Click Environment Variables.
  3. Under System Variables, find and select Path → Click Edit.
  4. Click New and add these paths:

C:\Users\YourUsername\AppData\Local\Programs\Python\PythonXX\ 
C:\Users\YourUsername\AppData\Local\Programs\Python\PythonXX\Scripts\        

5. Click OK and restart your computer.

After restarting, open Command Prompt and type:

python --version        

If you see the Python version number, you’re all set!


4. Disable Microsoft Store Python?Alias

Windows sometimes redirects python commands to the Microsoft Store. To prevent this:

  1. Open SettingsAppsApps & features.
  2. Click on Manage app execution aliases.
  3. Find Python.exe and disable it.

This ensures Windows uses your installed Python instead of redirecting to the Microsoft Store.


5. Verify Python Installation

After applying these fixes, test Python by running:

python --version
python3 --version        

You should see an output like:

Python 3.X.X        

If it works, you’re now ready to start coding! ??


6. Creating and Using a Virtual Environment

A virtual environment helps isolate project dependencies. Here’s how to create one:

python -m venv venv        

To activate it:

  • Windows (CMD / PowerShell):

venv\Scripts\activate        

  • Mac/Linux:

source venv/bin/activate        

You should now see (venv) in your terminal prompt, meaning the virtual environment is active.


Final Thoughts

Setting up Python correctly on Windows can sometimes be tricky, but following these steps should resolve the “Python not found” error.

Weverson Barbieri de Oliveira

Junior Software Engineer | Developer | Technology | C++ | Python | Data Analysis | Automotive Systems | AutoSar

3 周

Awesome!

回复

要查看或添加评论,请登录

Jaya Prakash Narayana Raavi的更多文章