Executing python scripts

Discussion in 'Python' started by Shufen, Oct 22, 2004.

  1. Shufen

    Shufen Guest

    Hi,

    Can someone please advice me on the differences between this:
    #!/usr/bin/env python and these: #!/usr/local/bin/python or
    #!/usr/bin/python?

    I know the first one locates the Python interpreter according to my
    system searching path setting. But I read about an article that
    mentioned that if we are running the scripts as a CGI from a Web
    server then we should use the latter one. Because I'm using python
    scripts as a CGI now and I'm currently using #!/usr/bin/env python
    this and it seems fine to me, so I would like to know if there is any
    difference.

    Thank you for any help.



    Shufen
     
    Shufen, Oct 22, 2004
    #1
    1. Advertising

  2. Shufen <> wrote:

    > Hi,
    >
    > Can someone please advice me on the differences between this:
    > #!/usr/bin/env python and these: #!/usr/local/bin/python or
    > #!/usr/bin/python?
    >
    > I know the first one locates the Python interpreter according to my
    > system searching path setting. But I read about an article that


    Right. The other two hardwire the location. The first will not work on
    an installation which only has Python in /usr/bin, and viceversa.

    > mentioned that if we are running the scripts as a CGI from a Web
    > server then we should use the latter one. Because I'm using python
    > scripts as a CGI now and I'm currently using #!/usr/bin/env python
    > this and it seems fine to me, so I would like to know if there is any
    > difference.


    As long as you control your PATH, and what gets installed where in
    directories along your PATH, you should be fine.


    Alex
     
    Alex Martelli, Oct 22, 2004
    #2
    1. Advertising

  3. Shufen

    Peter Hansen Guest

    Alex Martelli wrote:
    > Shufen <> wrote:
    >
    >
    >>Hi,
    >>
    >>Can someone please advice me on the differences between this:
    >>#!/usr/bin/env python and these: #!/usr/local/bin/python or
    >>#!/usr/bin/python?
    >>
    >>I know the first one locates the Python interpreter according to my
    >>system searching path setting. But I read about an article that

    >
    > Right. The other two hardwire the location. The first will not work on
    > an installation which only has Python in /usr/bin, and viceversa.


    To clarify (since I misunderstood this when I first read it): Alex
    means "the first of the these", referring to the two that don't
    look in the search path, when he writes "the first" (and not the
    previously referenced "first one" as it seems, at first :).

    -Peter
     
    Peter Hansen, Oct 22, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jan Danielsson
    Replies:
    8
    Views:
    644
    Mike Meyer
    Jul 22, 2005
  2. Jp Calderone
    Replies:
    0
    Views:
    467
    Jp Calderone
    Jul 21, 2005
  3. davidj411
    Replies:
    0
    Views:
    552
    davidj411
    Jun 27, 2008
  4. Astan Chee
    Replies:
    0
    Views:
    237
    Astan Chee
    Jul 13, 2010
  5. David Thomas
    Replies:
    20
    Views:
    1,487
    Hans Mulder
    Jun 27, 2012
Loading...

Share This Page