Hello. I have been trying to run a simple script in Windows 7 DOS using the python command, but it returns this error message:
'python' is not recognized as an internal or external command, operable program, or batch file.
I've looked up how to fix on Google, but I can't find anything specifically for Windows 7 and this issue.
Please help and thank you in advance!

Recommended Answers

What version have you installed from http://python.org/download/ and does your current path include the installation location? Do you have PYTHONPATH set?

Jump to Post

Hello. I have been trying to run a simple script in Windows 7 DOS using the python command

Dont call it DOS because it`s a long time since windows had DOS.
Windows 98 is the last version based on MS‑DOS.

Command Prompt is sometimes incorrectly referred to as "the DOS …

Jump to Post

Could you post exactly what you did? You can go Advanced Editor and attach JPG screen capture of Alt-PrintScreen (which by the way works beautifully in Linux, hope Microsoft has impoved it in Windows7, I still us WindowsXP) window capture saved in file.

Jump to Post

All 10 Replies

What version have you installed from http://python.org/download/ and does your current path include the installation location? Do you have PYTHONPATH set?

What version have you installed from http://python.org/download/ and does your current path include the installation location? Do you have PYTHONPATH set?

I have version 3.2 installed and no, I don't think so. How do I set PYTHONPATH?

Hello. I have been trying to run a simple script in Windows 7 DOS using the python command

Dont call it DOS because it`s a long time since windows had DOS.
Windows 98 is the last version based on MS‑DOS.

Command Prompt is sometimes incorrectly referred to as "the DOS prompt" or as MS-DOS itself. Command Prompt is a Windows program that emulates many of the command line abilities available in MS-DOS but it is not actually MS-DOS.

How do I set PYTHONPATH?

Add PYTHONPATH to Environment Variables.
http://www.windows7hacker.com/index.php/2010/05/how-to-addedit-environment-variables-in-windows-7/
To path add ;C:\python32\;C:\python32\scripts;
If install in other folder than this(default),type in correct path to that folder.
A good python editor make it easier to run code,look at pyscripter.
http://code.google.com/p/pyscripter/

Thank you so much!!!!!!!!!!!!!!!!!!!

So, I tried running a script and while the python command works now, it says this:
python: can't open file 'Hello_world.py' [Errno2] No such file or directory
I've tried adjusting the Path and PYTHONPATH environment variables but it won't work.
I'm not sure how to get it directed to the folder I want.
Please help.

Could you post exactly what you did? You can go Advanced Editor and attach JPG screen capture of Alt-PrintScreen (which by the way works beautifully in Linux, hope Microsoft has impoved it in Windows7, I still us WindowsXP) window capture saved in file.

First I created the PYTHONPATH variable, and I put C:\python32;C:\python32\projects (where I keep my scripts). That didn't work, so I put that into the Path variable. While it got python working, it couldn't find the files I wanted to use in the projects folder.

If you are working from the command prompt, change directory to the location of your script and try again. OR stay where you are and invoke python on the full path of the script: python C:\joeflims\pywork\one\script1.py

Just a note,dont use singel \ it can be used as an escape character.
For windows always python C:\\my_script\\script.py or python C:/my_script/script.py

... Or use raw string r"c:\my\path\worlds_best.py"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.