python Noob - basic setup question / problem

Discussion in 'Python' started by Lilavivat, Dec 4, 2006.

  1. Lilavivat

    Lilavivat Guest

    Running SUSE 10.1 on an AMD64. When I try and run a python program I get
    the following error:

    /usr/bin/python2: bad interpreter: No such file or directory

    "which python" gives me "/usr/local/bin/python"

    "which python2.4" gives me "/usr/local/bin/python2.4"

    But /usr/bin/python is symlinked to python2.4 "python -> python2.4"

    "which python2" and nothing comes up.

    Basically I have no idea what's going on... help please!

    Thanks,
    SETH
     
    Lilavivat, Dec 4, 2006
    #1
    1. Advertisements

  2. Lilavivat

    Christophe Guest

    Lilavivat a écrit :
    Fault of the Python program : it hardcodes that the Python interpreter
    is /usr/bin/python2

    Check the first line of the executable ( I bet it is a simple text file
    so go away and edit it with emacs/vim/joe/ed ... ). It should be ( with
    maybe a few spaces here and there ) :
    #!/usr/bin/python2

    replace it with :
    #!/usr/bin/python
     
    Christophe, Dec 4, 2006
    #2
    1. Advertisements

  3. Try to understand what "which" does. It says which file it calls if
    you input the parameter into the shell. So if this happens

    $ which python
    /usr/local/bin/python

    there's no point looking at /usr/bin/python.

    What does "ls -l /usr/local/bin/python" say? I bet it's a dangling
    symlink.

    Regards,


    Björn
     
    Bjoern Schliessmann, Dec 4, 2006
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.