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

python

Solution

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

Problem

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.

Original source