Why XP can not run Python after being setting the PATH?

D

Daniel Mark

Hello all:

I have set the PATH for Python as follows:

My Computer->Properties->Advanced->Environment Variables->System
Variables->Path

....; C:\Program Files\Python24;

Then I try to run python under command line

C:\>python

C:\>python.exe

I got nothing:)

It works iff I run as follows:

C:\>"Program Files\Python24\python.exe"
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
My question is how I can set the path so that the XP can run python
without the full path?


Thank you very much
-Daniel
 
R

Ray

By any chance the command window hasn't been restarted after you've
changed the PATH? Strange that looks OK.

If you do echo %PATH% what does it tell you, is Python there?

Cheers
Ray

Daniel said:
Hello all:

I have set the PATH for Python as follows:

My Computer->Properties->Advanced->Environment Variables->System
Variables->Path

...; C:\Program Files\Python24;

Then I try to run python under command line

C:\>python

C:\>python.exe

I got nothing:)

It works iff I run as follows:

C:\>"Program Files\Python24\python.exe"
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
My question is how I can set the path so that the XP can run python
without the full path?


Thank you very much
-Daniel
 
S

Sybren Stuvel

Daniel Mark enlightened us with:
I have set the PATH for Python as follows:

My Computer->Properties->Advanced->Environment Variables->System
Variables->Path

...; C:\Program Files\Python24;

That space between the ; and C:\, I guess it shouldn't be there.

Sybren
 
D

Dennis Lee Bieber

Daniel Mark enlightened us with:

That space between the ; and C:\, I guess it shouldn't be there.
A second suggestion would be: don't install Python in "Program
Files", but put it at the top level of the partition (ie; C:\Python24\)

Some programs still have problems with embedded spaces in paths,
especially when it has to be sent to a command line at some stage.

Compare what happens if you type (note: mine is on e:):
-=-=-=-=-=-
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Dennis Lee Bieber>
c:\program files\python24\python.exe
'c:\program' is not recognized as an internal or external command,
operable program or batch file.

C:\Documents and Settings\Dennis Lee Bieber>
"c:\Program Files\python24\python.exe"
The system cannot find the path specified.

C:\Documents and Settings\Dennis Lee Bieber>e:\python24\python.exe
ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on
Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.

C:\Documents and Settings\Dennis Lee Bieber>
-=-=-=-=-=-
(I hand wrapped the command lines so they aren't split)
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
D

Daniel Mark

Hello Dennis:
A second suggestion would be: don't install Python in "Program
Files", but put it at the top level of the partition (ie; C:\Python24\)
I guess your comment is right.
However, I would like to install Python under directory
"C:\Program Files\Python24"

Also, I list some screen shot from my machine as follows:

C:\Program Files\Python24>cd \

C:\>python

C:\>"Program Files\Python24\python.exe"
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.

C:\>Program\ Files\Python24\python.exe
'Program\' is not recognized as an internal or external command,
operable program or batch file.

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

It seems that XP know there is python.exe there, but cannot run it
correctly if
i use c:\python

The only way works on my machine is to run with full path.

Maybe there is not solution to this problem:)?

Thank you all:)
 
D

Daniel Mark

Hello Ray:

Python is on my Path list as follows:

C:\Program Files\Python24>echo %path%
C:\Program
Files\texmf\miktex\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\cygwin\usr\local\bin;c:\cygwin\bin;C:\P
rogram Files\Java\jdk1.5.0_06\bin;C:\Program
Files\gp400win32\gnuplot\bi
n;C:\Program Files\Python24;C:\Program Files\j2sdk1.4.2_09\bin;

So I don't think that is the real problem:)
thank you


By any chance the command window hasn't been restarted after you've
changed the PATH? Strange that looks OK.

If you do echo %PATH% what does it tell you, is Python there?

Cheers
Ray

Daniel said:
Hello all:

I have set the PATH for Python as follows:

My Computer->Properties->Advanced->Environment Variables->System
Variables->Path

...; C:\Program Files\Python24;

Then I try to run python under command line

C:\>python

C:\>python.exe

I got nothing:)

It works iff I run as follows:

C:\>"Program Files\Python24\python.exe"
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
My question is how I can set the path so that the XP can run python
without the full path?


Thank you very much
-Daniel
 
J

John Salerno

Daniel said:
Maybe there is not solution to this problem:)?

Did you not try Sybren's suggestion? Remove the space between the
semicolon and the path and it should work. It worked (and didn't work)
for me when I tested it.
 
B

Brian McFarland

Dumb question... but you're 100% positive your python install is in
"C:\Program Files\Python24" and not just "C:\Python24" Right?


Also, an alternative approach to being able to run python from the
command line is to add it to the path variable in each instance of
cmd.exe when it starts up. To do this, run regedit, then edit the key
"HKEY_CURRENT_USER\Software\Microsoft\Command Process\AutoRun" You
might have to add the key autorun if it's not there, and this can be
done in CURRENT_USER or LOCAL_MACHINE. Enter the value :

PATH %PATH%;C:\progra~1\python24;


I use this approach to add directories containing other command line
tools that I don't necessarily want in the path all the time since a
cluttered path can cause problems sometimes.
 
D

Daniel Mark

Hello John:

I did try, however, it doesn't work on my machine.


Thank you
-Daniel
 
J

John Salerno

Daniel said:
Hello John:

I did try, however, it doesn't work on my machine.


Thank you
-Daniel

well that is baffling...it works normally otherwise? there could be
something wrong with the installation maybe, but the line you have in
the PATH (without spaces) should work...putting quotes around "Program
File" doesn't seem to be required...

let me know if you figure it out! i'll keep thinking....
 
J

John Machin

Daniel said:
Also, I list some screen shot from my machine as follows:

C:\Program Files\Python24>cd \

C:\>python

#### Note: *no* error message !!! [or you edited the screen shot]

Hypothesis: there is something called python.exe or python.bat or
whatever somewhere in your path before the c:\program files\python24
[*OR* in the root (c:\) folder!!!]. When run, it does nothing (we
hope!).

Try getting it to mumble something that might reveal its identity, by
typing something like

C:\>python -h
C:\>python /?
C:\>python foo bar zot

Have a look in each of those folders (including the root!!) and see
what you find there. [If I were forced to bet, I'd put my money on
cygwin].
Then either adjust your path or blow away the intruder. If you aren't
sure which is more appropriate, ask.

BTW, most folk got out of the habit of issuing commands at the root
directory level (and keeping files at that level) pretty soon after
MS-DOS 2.0 came out. Following that herd is not such a bad idea :)
C:\>"Program Files\Python24\python.exe"
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.

C:\>Program\ Files\Python24\python.exe
'Program\' is not recognized as an internal or external command,
operable program or batch file.

#### This is the expected error message.
 
D

Daniel Mark

Dear John:
Have a look in each of those folders (including the root!!) and see
what you find there. [If I were forced to bet, I'd put my money on
cygwin].

You are a genius!!!

My machine was intalled python in cygwin:)

I didn't expect that I could get so much helps from this forum.
My heartfelt thanks go out to John and all friends here:)

-Daniel
 
J

John Machin

Daniel said:
Dear John:
Have a look in each of those folders (including the root!!) and see
what you find there. [If I were forced to bet, I'd put my money on
cygwin].

You are a genius!!!

No, it was just a matter of noticing that the dog didn't bark :)
My machine was intalled python in cygwin:)

I didn't expect that I could get so much helps from this forum.
My heartfelt thanks go out to John and all friends here:)

You're welcome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top