WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: /usr/bin/python: bad interpreter: No such file or directory  (Read 7939 times)

Offline rhermsen

  • Wiki Author
  • Full Member
  • *****
  • Posts: 109
/usr/bin/python: bad interpreter: No such file or directory
« on: February 23, 2019, 10:54:13 AM »
I suspect I run into a similar issue like here http://forum.tinycorelinux.net/index.php/topic,21844.0.html
but now with Python.

I'm using TCL10.0 (x86) with Python2.7 installed.

I'm trying to make use of a python script, which has as header #!/usr/bin/python.

$ sudo /usr/local/etc/init.d/frr reload
Applying only incremental changes to running configuration from frr.conf
/usr/local/etc/init.d/frr: /usr/local/sbin/frr-reload.py: /usr/bin/python: bad interpreter: No such file or directory
$

Python is installed, and if I change the header to #!/usr/local/bin/python the script is working.

I hope someone can confirm this, and maybe even solve it?


Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: /usr/bin/python: bad interpreter: No such file or directory
« Reply #1 on: February 23, 2019, 11:20:56 AM »
Hi rhermsen
The  tce.installed  script for python used to contain the following line:
Code: [Select]
ln -sf /usr/local/bin/python2.7 /usr/bin/pythonI think extensions are basically supposed to install under  /usr/local/  rather than /usr/  so the removal of that link command may
have been intentional.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: /usr/bin/python: bad interpreter: No such file or directory
« Reply #2 on: February 23, 2019, 01:30:20 PM »
In other distros, there was a lot of confusion over which python should be linked as "python", ver 2 or ver 3. Not sure if that's related.
The only barriers that can stop you are the ones you create yourself.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: /usr/bin/python: bad interpreter: No such file or directory
« Reply #3 on: February 24, 2019, 01:50:16 AM »
The convention is for tinycore extensions to be compiled to /usr/local

This means that perl and python scripts need to reference /usr/local/bin/perl or /usr/local/bin/python

Alternatively, "/usr/bin/env perl" or "/usr/bin/env python" can be used.

In the case of python, the python(-2.7.x) extension contains /usr/local/bin/python, but the python3.6(.x) extension does not. This is done in order to avoid accidently using the python3.6 extension if it was loaded before the python extension.

If you want to sure of which version of python is used, it is better to use /usr/local/bin/python2.7 or /usr/local/bin/python3.6