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

2024/10/3 21:20:19

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.

Answer

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

https://en.xdnf.cn/q/70685.html

Related Q&A

pandas, dataframe, groupby, std

New to pandas here. A (trivial) problem: hosts, operations, execution times. I want to group by host, then by host+operation, calculate std deviation for execution time per host, then by host+operation…

Count occurrences of a couple of specific words

I have a list of words, lets say: ["foo", "bar", "baz"] and a large string in which these words may occur. I now use for every word in the list the "string".coun…

numpy: how to fill multiple fields in a structured array at once

Very simple question: I have a structured array with multiple columns and Id like to fill only some of them (but more than one) with another preexisting array.This is what Im trying:strc = np.zeros(4, …

Combine date column and time column into datetime column

I have a Pandas dataframe like this; (obtained by parsing an excel file)| | COMPANY NAME | MEETING DATE | MEETING TIME| --------------------------------------------------------…

Matplotlib Plot Lines Above Each Bar

I would like to plot a horizontal line above each bar in this chart. The y-axis location of each bar depends on the variable target. I want to use axhline, if possible, or Line2D because I need to be …

Flask-SQLAlchemy Lower Case Index - skipping functional, not supported by SQLAlchemy reflection

First off. Apologies if this has been answered but I can not find the answer any where.I need to define a lowercase index on a Flask-SQLAlchemy object.The problem I have is I need a models username and…

pip listing global packages in active virtualenv

After upgrading pip from 1.4.x to 1.5 pip freeze outputs a list of my globally installed (system) packages instead of the ones installed inside of my virtualenv. Ive tried downgrading to 1.4 again but …

Scrapy Crawler in python cannot follow links?

I wrote a crawler in python using the scrapy tool of python. The following is the python code:from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLin…

Remove commas in a string, surrounded by a comma and double quotes / Python

Ive found some similar themes on stackoverflow, but Im newbie to Python and Reg Exps.I have a string,"Completely renovated in 2009, the 2-star Superior Hotel Ibis BerlinMesse, with its 168 air-con…

I need help making a discord py temp mute command in discord py

I got my discord bot to have a mute command but you have to unmute the user yourself at a later time, I want to have another command called "tempmute" that mutes a member for a certain number…