skip to Main Content

I am facing an issue where I can run Python seamlessly within Visual Studio Code and the Python terminal. However, when I try to create a Python virtual environment using the command python -m venv venv or check the Python version with python –version, I encounter the following error message:

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

I have attempted to resolve this by uninstalling and reinstalling Python multiple times, and I even downloaded it from the Microsoft Store as prompted. Despite Python being successfully installed and capable of executing Python commands, the Command Prompt does not recognize its presence on my computer.

I even created a new folder containing a blank Python file and attempted to create a virtual environment from there, but the issue persists. My research into this problem has not yielded any conclusive explanations. Can anyone provide insights into why this might be happening?

2

Answers


  1. You may need to add Python to your PATH environment variable. See https://datatofish.com/add-python-to-windows-path/ .

    Login or Signup to reply.
  2. You can try using the full python path as the command.
    For example E:Desktopproject.venvScriptspython.exe --version.

    Of course, you can also add the environment variable path. You can also check this setting when installing python.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search