0

I am trying to access Python through a Windows command prompt, but am at an office and cannot add an Environment Variable. So, I cant follow the advice provided here. Thus, I added a User Environment Variable through User Accounts and use Variable:python and Value: C:\Python33. When I do a Windows Run check on %python% I reach the required Python33 folder. However, when I type python -Version in the command prompt I get the error 'python' is not recognized as an internal or external command, operable program or batch file. I am not sure how to proceed.

Community
  • 1
  • 1
Jojo
  • 1,117
  • 2
  • 15
  • 28

4 Answers4

4

Run Python from the command prompt and include the full path to python.exe. For example to get the version:

C:\Python33\python.exe --version

When you run a script you specify the path to the script if you're not in the directory where the script is located. For example, if your script is in C:\scripts and is called my_script.py:

C:\Python33\python.exe C:\scripts\my_script.py
Ken
  • 226
  • 1
  • 6
1

C:\Python33\python.exe pyscript.py should work.

The Amateur Coder
  • 789
  • 3
  • 11
  • 33
Neo
  • 49
  • 6
1

Instead of setting environment variables, you can use the whole path, like Neo wrote e.g.: C:\Python33\python.exe yourPythonScript.py

Remove any environment variables you have added.

Fara Importanta
  • 161
  • 1
  • 2
  • 10
0

I once Had a similar problem, but i couldnt find any solution, not even adding the path to the python folder was working. Then I opened Python and clicked in File, then browser path, and I found that I had another folder that contained the real Python folder, not the default one. Maybe it could work for you too.

Breno Baiardi
  • 99
  • 1
  • 16