The error "Python was not found; run without arguments to install from the Microsoft Store" occurs for 2 main reasons:
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 but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640
A quick fix you should try is to use the
py alias instead of
# 👇️ get the version py --version # 👇️ start Python interpreter py # 👇️ exit Python interpreter exit() # 👇️ install a Python package py -m pip install numpy # 👇️ run a Python script py my_script.py
If you have multiple Python versions installed, you can use a hyphen to specify
which version the
py command relates to, for example,
py -3 or
py -0command to check which Python versions are installed on your machine.
The screenshot shows that my active Python version is
3.10, but I also have
Here are examples of issuing
py commands scoped to Python
# 👇️ print Python 3.9 version py -3.9 --version # 👇️ start Python 3.9 interpreter py -3.9 # 👇️ exit interpreter exit() # 👇️ install package using Python 3.9 py -3.9 -m pip install requests
If you have multiple Python versions installed on your machine, your IDE might be using an incorrect version.
For example, In VSCode, you can press
CTRL + Shift + P or (
on Mac) to open the command palette.
Then type "Python select interpreter" in the field.
Then select the correct Python version from the dropdown menu.
If the error is not resolved, you have to add the path to Python and
your PATH environment variable.
To add the path to Python to your user's PATH environment variable:
py -c "import os, sys; print(os.path.dirname(sys.executable))" python -c "import os, sys; print(os.path.dirname(sys.executable))" where python
For me, the path is the following.
Note that I have Python 3.10 installed, which is reflected in the PATH.
Add the path to Python and then add the path to the
Scripts directory that
is located in your Python3X folder.
This is where the executable files are located, including
For me, it is the following path.
You might also have to restart your PC, but that's not always necessary.
Try to issue a
python command in a new shell session.
# 👇️ get version python --version # 👇️ start Python interpreter python # 👇️ exit Python interpreter exit() # 👇️ install Python package python -m pip install numpy # 👇️ run a Python script python my_file.py
If you still get the error, you have to disable the Python App installer in "App execution aliases".
If the error persists, try using
py instead of
# 👇️ get version py --version # 👇️ start Python interpreter py # 👇️ exit Python interpreter exit() # 👇️ install Python package py -m pip install numpy # 👇️ run a Python script py my_script.py
If you still get an error when issuing
python commands, use the official
installer to configure Python correctly.
If you still encounter issues, try to add Python to your PATH using the official installer.
Download the installer from the official python.org website.
If you have Python already installed, start the installer and click on "Modify".
You can leave the optional features ticked. Note that the
pip checkbox is
If that didn't work, your Python installation might be corrupted.
Start the installer again and click on "Uninstall".
Now that you don't have Python installed on your machine, start the installer again and make sure to tick the "Add python.exe to PATH" option.
The checkbox won't be checked by default.
Once the "Add python.exe to PATH" checkbox is checked, click on "Install Now".
After the installation, Python will be installed and configured properly.
Close your Power Shell application and reopen it.
Note that you must restart Power Shell for the changes to take effect.
python --version python exit() python -m pip install requests
pythoncommand, you have to open CMD as an administrator.
To open CMD as an administrator:
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".
Once you start CMD as an administrator, you should be able to issue
command without getting permission errors.
python --version python -m pip install requests python -m pip install requests --user
You can also use the
--user option which installs the package for the specific
user and doesn't require elevated permissions.
If the error persists, try to restart your PC to make sure you don't have stale IDE and shell sessions.
To solve the error "Python was not found; run without arguments to install from the Microsoft Store", make sure:
You can learn more about the related topics by checking out the following tutorials: