python Noob - basic setup question / problem

L

Lilavivat

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
 
C

Christophe

Lilavivat a écrit :
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
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
 
B

Bjoern Schliessmann

Lilavivat said:
/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"

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
 

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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top