473,287 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

python at command prompt

Hi,
I am python newbie and the command prompt is having an issue with
python. I installed python 2.4.4 onto my windows machine, opened a
command prompt window, and typed python to start the interactive mode.
Got the following error.

D:\>python
'python' is not recognized as an internal or external command,
operable program or batch file.

The following programs work fine
IDLE (Python GUI)
Python (command line)
PythonWin

For some strange reason, python is not recognized at the command
prompt.
Does anyone have any ideas as to why this is happening?
thanks,

Nov 1 '07 #1
13 3963
D:\>python
'python' is not recognized as an internal or external command,
operable program or batch file.
[snip]
For some strange reason, python is not recognized at the command
prompt.
Sounds like your path isn't set correctly. See the first section
here[1] on "Finding python.exe"

-tkc

[1]http://www.imladris.com/Scripts/PythonForWindows.html

Nov 1 '07 #2
[snip]
Sounds like your path isn't set correctly. See the first section
here[1] on "Finding python.exe"

-tkc

[1]http://www.imladris.com/Scripts/PythonForWindows.html
Thanks Tim,
I set the pythonpath to where the python interpreter is located C:
\Python24
However I still get the same error message. Is there something else
that must be configured?
thanks.

Nov 1 '07 #3
* c3*****@hotmail.com wrote (on 11/1/2007 9:58 AM):
[snip]
>Sounds like your path isn't set correctly. See the first section
here[1] on "Finding python.exe"

-tkc

[1]http://www.imladris.com/Scripts/PythonForWindows.html

Thanks Tim,
I set the pythonpath to where the python interpreter is located C:
\Python24
However I still get the same error message. Is there something else
that must be configured?
thanks.
It's not the PYTHONPATH environment variable that you need to set.

You need to set the PATH environment variable to include C:\Python24.
That is where the Python executable is locate.

Mark
Nov 1 '07 #4
>[1]http://www.imladris.com/Scripts/PythonForWindows.html
>
I set the pythonpath to where the python interpreter is located C:
\Python24
However I still get the same error message. Is there something else
that must be configured?
Make sure you're setting your PATH, not your PYTHONPATH variable.

From your command-prompt, issue

c:\test\path

to see what your current path is. You _should_ see your
python2.x\bin folder in there. If not, are you re-using the same
command-prompt window? I vaguely remember that it requires you
to close the cmd window and open a new one to pick up the new
environment-variable changes.

Alternatively, if you don't want to lose history in that
particular window, you can update your path for that particular
window using

c:\test\set path=%PATH%;c:\progra~1\python2.4\bin

or whatever your path is.

-tkc

Nov 1 '07 #5
On Nov 1, 1:23 pm, Tim Chase <python.l...@tim.thechases.comwrote:
[1]http://www.imladris.com/Scripts/PythonForWindows.html
I set the pythonpath to where the python interpreter is located C:
\Python24
However I still get the same error message. Is there something else
that must be configured?

Make sure you're setting your PATH, not your PYTHONPATH variable.

From your command-prompt, issue

c:\test\path

to see what your current path is. You _should_ see your
python2.x\bin folder in there. If not, are you re-using the same
command-prompt window? I vaguely remember that it requires you
to close the cmd window and open a new one to pick up the new
environment-variable changes.

Alternatively, if you don't want to lose history in that
particular window, you can update your path for that particular
window using

c:\test\set path=%PATH%;c:\progra~1\python2.4\bin

or whatever your path is.

-tkc
And if you don't want to do it via the command line, you can right-
click My Computer, choose Properties, click the Advanced Tab and then
hit the Environmental Variables (or just press the Windows Key and
Pause/Break). Anyway, you'll see 2 boxes. Choose the lower one labeled
"System Variables", double-click the Variable labeled "path" and then
just add the path to your Python folder (make sure to separate it from
the one before it with a semi-colon.

For me, it would be something like C:\Python24

Mike

Nov 1 '07 #6
On Nov 1, 9:58 am, c395...@hotmail.com wrote:
[snip]
Sounds like your path isn't set correctly. See the first section
here[1] on "Finding python.exe"
-tkc
[1]http://www.imladris.com/Scripts/PythonForWindows.html

Thanks Tim,
I set the pythonpath to where the python interpreter is located C:
\Python24
However I still get the same error message. Is there something else
that must be configured?
thanks.
You don't want to use PYTHONPATH for pointing to the python
executable. PYTHONPATH is for telling python where to look for
modules. What you need to do is set PATH to point to where the python
exectuable lives (probably C:\Python24) and you might want to add the
scripts directory as well (c:\Python24\Scripts).

To do that, right click on 'My Computer' select 'properties'. In the
dialog that appears select the 'Advanced' tab. Click the 'Environment
Variables' button near the bottom of the dialog. In the System
variables section of the new window look for a variable named 'Path',
and edit its contents to include C:\Python24 and C:\Python24\Scripts.
Each entry should be separated by a semi-colon. There is also a way to
do this by editing the registry which I'm sure you could find by doing
a google search.

I'm a little surprised that python doesn't do this by default, or at
least give it as an option during installation.

Matt

Nov 1 '07 #7
On Thu, 01 Nov 2007 09:17:00 -0700, c3*****@hotmail.com wrote:
>Hi,
I am python newbie and the command prompt is having an issue with
python. I installed python 2.4.4 onto my windows machine, opened a
command prompt window, and typed python to start the interactive mode.
Got the following error.

D:\>python
'python' is not recognized as an internal or external command,
operable program or batch file.

The following programs work fine
IDLE (Python GUI)
Python (command line)
PythonWin

For some strange reason, python is not recognized at the command
prompt.
Does anyone have any ideas as to why this is happening?
thanks,
There's could also be an issue with entering 'python' at the command
line, and not 'python.exe'. Once the PATH is setup correctly, try to
enter 'python.exe', and check whether that works.

IMHO, to get any 'program-name' (without the .exe extension) to work,
one needs to:
1. register the executable with windows (doesn't work for python) or
2. make sure the the PATHEXT environment variable is set correctly,
and includes the .EXE extension (on my w2k system it looks like:
..COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH)

--
Ton

Nov 2 '07 #8
Ton van Vliet <sh***********@green.meadowwrote:
>
There's could also be an issue with entering 'python' at the command
line, and not 'python.exe'. Once the PATH is setup correctly, try to
enter 'python.exe', and check whether that works.

IMHO, to get any 'program-name' (without the .exe extension) to work,
one needs to:
1. register the executable with windows (doesn't work for python) or
2. make sure the the PATHEXT environment variable is set correctly,
and includes the .EXE extension (on my w2k system it looks like:
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WS H)
You're confusing two things here. Executables (.exe) are always available,
and do not need to be registered to be run without the extension.

It is possible to have Windows execute "abc.py" when you type "abc", and
that DOES require registering the .py extension and adding .py to the
PATHEXT environment variable.

A very useful thing to do, by the way. I have many command line tools for
which I have forgotten whether they are batch files, small executables, or
Python scripts. And that's how it should be.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 3 '07 #9
Tim Roberts wrote:
Ton van Vliet <sh***********@green.meadowwrote:
>There's could also be an issue with entering 'python' at the command
line, and not 'python.exe'. Once the PATH is setup correctly, try to
enter 'python.exe', and check whether that works.

IMHO, to get any 'program-name' (without the .exe extension) to work,
one needs to:
1. register the executable with windows (doesn't work for python) or
2. make sure the the PATHEXT environment variable is set correctly,
and includes the .EXE extension (on my w2k system it looks like:
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WS H)

You're confusing two things here. Executables (.exe) are always available,
and do not need to be registered to be run without the extension.

It is possible to have Windows execute "abc.py" when you type "abc", and
that DOES require registering the .py extension and adding .py to the
PATHEXT environment variable.

A very useful thing to do, by the way. I have many command line tools for
which I have forgotten whether they are batch files, small executables, or
Python scripts. And that's how it should be.
That is,

"Executables (.exe) are always available,"
.... provided that the PATHEXT environment variable
has not been set incorrectly...

and
"Executables ... do not need to be registered"
[david]
Nov 5 '07 #10
On Sat, 03 Nov 2007 22:51:05 GMT, Tim Roberts <ti**@probo.comwrote:
>Ton van Vliet <sh***********@green.meadowwrote:
>>
There's could also be an issue with entering 'python' at the command
line, and not 'python.exe'. Once the PATH is setup correctly, try to
enter 'python.exe', and check whether that works.

IMHO, to get any 'program-name' (without the .exe extension) to work,
one needs to:
1. register the executable with windows (doesn't work for python) or
2. make sure the the PATHEXT environment variable is set correctly,
and includes the .EXE extension (on my w2k system it looks like:
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH )
please note that I state 1 *or* 2
>You're confusing two things here. Executables (.exe) are always available,
and do not need to be registered to be run without the extension.
but *only* if the PATHEXT environment variable is setup correctly
>It is possible to have Windows execute "abc.py" when you type "abc", and
that DOES require registering the .py extension and adding .py to the
PATHEXT environment variable.
There are executables (.exe) that have a 'registering' option builtin,
and need to be registered to have their capabilities made available
using the /regserver switch (possibly related to OLE/COM services, but
I'm not an expert here ;-)

see: http://consumer.installshield.com/kb.asp?id=Q108199 (last para)
>A very useful thing to do, by the way. I have many command line tools for
which I have forgotten whether they are batch files, small executables, or
Python scripts. And that's how it should be.
--
Ton
Nov 5 '07 #11
On Mon, 05 Nov 2007 11:03:36 +1100, "[david]" <da***@nospam.spam>
wrote:
>Tim Roberts wrote:
>Ton van Vliet <sh***********@green.meadowwrote:
>>There's could also be an issue with entering 'python' at the command
line, and not 'python.exe'. Once the PATH is setup correctly, try to
enter 'python.exe', and check whether that works.

IMHO, to get any 'program-name' (without the .exe extension) to work,
one needs to:
1. register the executable with windows (doesn't work for python) or
2. make sure the the PATHEXT environment variable is set correctly,
and includes the .EXE extension (on my w2k system it looks like:
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH )

You're confusing two things here. Executables (.exe) are always available,
and do not need to be registered to be run without the extension.

It is possible to have Windows execute "abc.py" when you type "abc", and
that DOES require registering the .py extension and adding .py to the
PATHEXT environment variable.

A very useful thing to do, by the way. I have many command line tools for
which I have forgotten whether they are batch files, small executables, or
Python scripts. And that's how it should be.

That is,

"Executables (.exe) are always available,"
... provided that the PATHEXT environment variable
has not been set incorrectly...
Right
>and
"Executables ... do not need to be registered"
Right also, however they may be 'registered' to get a 'similar' kind
of response:

If you have a look at the following registry key:
HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths
you may find several 'registered' applications that can be launched
without appending the .exe extension from the 'start|run' menu

If you want to experiment for yourself: (needless to say: be carefull)

1. Select a small stand-alone .exe application of your choice
2. *copy* the .exe into some directory that is not on your PATH (e.g.
d:\temp)
3. Rename the application (e.g. to 'eppo.exe')
4. Open regedit and add an 'eppo.exe' to the above mentioned 'App
Paths' key
5. Modify its (Default) value to 'd:\temp\eppo.exe'

From now on you can just enter 'eppo' at 'Start|Run' entry field, to
launch the application

To make entering 'eppo' working at the command prompt, the directory
in which the eppo.exe is located must be in the (search) PATH, even if
the PATHEXT is *not* setup correctly.

If the applications directory is not on your PATH, you may still start
it with 'start eppo'

I definitely am not an expert in this area, so may someone else may
come with a better explanation of this .exe registering stuff, I'm
sure there's more involved (like setting of the 'open with' keys,
registering COM servers, etc) but I just wanted to bring up that
'registering' executables is not *that* uncommon.

HTH ;-)
--
Ton
Nov 5 '07 #12
Ton van Vliet <sh***********@green.meadowwrote:
>
There are executables (.exe) that have a 'registering' option builtin,
and need to be registered to have their capabilities made available
using the /regserver switch (possibly related to OLE/COM services, but
I'm not an expert here ;-)
Yes, that's strictly for COM. And the "App Paths" registry key you
mentioned is only for Explorer things, like the Start menu's "Run" box. It
doesn't apply to the command line. Try typing "wordpad" in a cmd shell,
then try it in Start -Run.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 6 '07 #13
On Tue, 06 Nov 2007 04:20:17 GMT, Tim Roberts <ti**@probo.comwrote:
>>There are executables (.exe) that have a 'registering' option builtin,
and need to be registered to have their capabilities made available
using the /regserver switch (possibly related to OLE/COM services, but
I'm not an expert here ;-)

Yes, that's strictly for COM.
Thanks for the confirmation.
>And the "App Paths" registry key you mentioned is only for Explorer
things, like the Start menu's "Run" box. It doesn't apply to the
command line. Try typing "wordpad" in a cmd shell, then try it
in Start -Run.
Which, as I learned now, can be 'simulated' by typing 'start wordpad'
at the command line (I wasn't aware of that before)

Let's hope the OP got his problem solved ;-)

--
Ton
Nov 6 '07 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Endless Story | last post by:
My last version of Python was 2.4, running smoothly on XP with path c: \Python24 - no need even to include this path in PATH; everything worked as it's supposed to at the command line. Just...
12
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed...
5
by: waltbrad | last post by:
Hi folks. I'm learning Python from the Mark Lutz Book, Programming Python 3rd edition. He seems to be able to invoke the Python interpreter from any command line prompt. C:\temp>python ...
6
by: globalrev | last post by:
type "python setup.py install" that is used in most "addons" for python. well using windows vista, where the h*** am i supposed to type this? if it is not doable in windows, what do i have...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.