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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Mark

    #1

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

    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

  • Ray

    #2
    Re: Why XP can not run Python after being setting the PATH?

    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 Mark wrote:
    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

    Comment

    • Daniel Mark

      #3
      Re: Why XP can not run Python after being setting the PATH?

      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.
      >>^Z

      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:)

      Comment

      • Daniel Mark

        #4
        Re: Why XP can not run Python after being setting the PATH?

        Hello Ray:

        Python is on my Path list as follows:

        C:\Program Files\Python24> echo %path%
        C:\Program
        Files\texmf\mik tex\bin;C:\WIND OWS\system32;C: \WINDOWS;C:\cyg win\usr\local\b in;c:\cygwin\bi n;C:\P
        rogram Files\Java\jdk1 .5.0_06\bin;C:\ Program
        Files\gp400win3 2\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



        Ray wrote:
        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 Mark wrote:
        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

        Comment

        • John Salerno

          #5
          Re: Why XP can not run Python after being setting the PATH?

          Daniel Mark wrote:
          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.

          Comment

          • Brian McFarland

            #6
            Re: Why XP can not run Python after being setting the PATH?

            Dumb question... but you're 100% positive your python install is in
            "C:\Program Files\Python24" and not just "C:\Python2 4" 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_U SER\Software\Mi crosoft\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:\progr a~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.

            Comment

            • Daniel Mark

              #7
              Re: Why XP can not run Python after being setting the PATH?

              Hello John:

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


              Thank you
              -Daniel


              John Salerno wrote:
              Daniel Mark wrote:
              >
              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.

              Comment

              • John Salerno

                #8
                Re: Why XP can not run Python after being setting the PATH?

                Daniel Mark wrote:
                Hello John:
                >
                I did try, however, it doesn't work on my machine.
                >
                >
                Thank you
                -Daniel
                >
                >
                John Salerno wrote:
                >Daniel Mark wrote:
                >>
                >>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.
                >
                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....

                Comment

                • John Machin

                  #9
                  Re: Why XP can not run Python after being setting the PATH?

                  Daniel Mark wrote:
                  >
                  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.
                  >^Z
                  >
                  >
                  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.
                  >
                  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:)?

                  Comment

                  • Daniel Mark

                    #10
                    Re: Why XP can not run Python after being setting the PATH?

                    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

                    Comment

                    • John Machin

                      #11
                      Re: Why XP can not run Python after being setting the PATH?


                      Daniel Mark wrote:
                      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.

                      Comment

                      Working...