-1

while running python3 -m venv on windows

it shows error

'python3' is not recognized as an internal or external command, operable program or batch file

1 Answers1

1

This question has already been discussed, see here for example. So:

First: Did you verify that the path was added to environment variables?

See here for more details on adding the path to environment variables (Section 3.3. Configuring Python).

Secondly: There is a "Python launcher" for Windows. It's an utility which aids in locating and executing of different Python versions. It allows scripts (or the command-line) to indicate a preference for a specific Python version, and will locate and execute that version.

Unlike the PATH variable, the launcher will correctly select the most appropriate version of Python. It will prefer per-user installations over system-wide ones, and orders by language version rather than using the most recently installed version.

This launcher is simply py.

To launch your script or virtual environment in command line simply do this:

py your_script.py or py -m venv ENV_DIR

If you have multiple versions of Python installed (2.x, 3.x), just specify the version you want to run like this:

py -2.7 your_script.py or py -3.6 your_script.py

If you want the latest version of Python 2.x or python 3.x you have installed, try the command:

py -2 your_script.py or py -3 your_script.py

More details here

Tobin
  • 2,029
  • 2
  • 11
  • 19