Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/usr/bin/env: python2.6: No such file or directory error

Tags:

python

I have python2.6, python2.7 and python3 in my /usr/lib/

I am trying to run a file which has line given below in it as its first line

#!/usr/bin/env python2.6

after trying to run it it gives me following error

/usr/bin/env: python2.6: No such file or directory

my default version on python is 2.7.

How I can run the file without changing the default version of python.

like image 715
big Avatar asked May 16 '12 17:05

big


1 Answers

I think you might be confused about the location of your python executables, versus the location of the lib site-packages.

Your python site-packages should be here:
/usr/lib/python2.6/site-packages

But your executables should probably be here:
/usr/bin

If you run this following command, it should tell you where it is currently finding the executables:

which python
which python2.7
...

Your $PATH environment variable should contain paths that have executable files directly underneath. i.e. $ echo $PATH
/usr/bin:/usr/local/bin:/home/aUser/bin

If your executable is in another location that is not in your path and you don't want to neccessarily add that location to your path, you can also just symlink it to somewhere normal....

ln -s /path/to/executable /usr/bin/executable

Here is a trick to find all the executable files named python:

find /usr -type f -name 'python*' -perm -a+x

This might help you locate python2.6

like image 170
jdi Avatar answered Nov 04 '22 13:11

jdi