Explain Codes LogoExplain Codes Logo

Cmd opens Windows Store when I type 'python'

python
environment-variables
path-priority
python-installation
Anton ShumikhinbyAnton Shumikhin·Nov 17, 2024
TLDR

Here's your quick fix: Make sure Python is installed and its PATH is correctly set in the environment variables. To do this, install Python from the official site and tick the 'Add Python to PATH' box during the installation process.

If Python is already installed, find python.exe and run it using its full path:

%LocalAppData%\Programs\Python\PythonXY\python.exe

Change PythonXY to match your version of Python. This helps CMD find the Python interpreter it should use.

Solving the Windows/Python riddle

Disabling jumbled aliases

In the event that CMD pushes you towards the Windows Store, head off to your Windows search bar and type "Manage app execution aliases". Unselect the Python aliases; this halts any fake python.exe files.

Checking the PATH

If CMD is still throwing fits post Python installation, we might need a bit of "Path Priority". Move the Python installation directory above the WindowsApps folder in your PATH. Editing the system environment variables solidifies this change.

Exploring other Python realms

For those who prefer smoother sails, the Anaconda Python distribution may be your ideal port. It offers a more consistent Python environment and meshes well with Windows.

In-depth troubleshooting

Verifying your Python installation

If Windows Store is still gatecrashing your Python parties even after the fixes, your Python installation might need a checkup. Use the modify or repair options in Apps & features settings to fix any boo-boos.

Creating custom variables

For a midas touch, you might consider crafting an environment variable specifically for your Python interpreter. This custom link could end conflicts and reign victorious in your Python quest.

Venturing into WindowsApps

Ready for the dragon's lair? If you're skilled enough, you can delete python*.exe in the WindowsApps directory as a last resort. But don't forget your shield! System alerts might pop up as files attempt to respawn.