Answer the question
In order to leave comments, you need to log in
How to force the script to be executed in the version of Python that is installed on the system?
Under the stupidly formulated question lies the following problem.
There is a script that works in both python2 and python3, which I plan to pack into a deb package for installation on Ubuntu 12.04 - Ubuntu 16.04, Debian 8, etc. The question is how to make the script work with the version of Python that already (previous -) installed in the distribution and do not produce deb's for each.
Specifically, I'm interested in what to write as a shebang, because if you use: #!/usr/bin/env python
then you need to install the second python, and in the other case - the third: #!/usr/bin/env python3
Of course, I found this hack stackoverflow.com/a/26056481/1446494 , but it's very dirty.
Answer the question
In order to leave comments, you need to log in
All wrong. #!/usr/bin/python
enough, because if you do: file /usr/bin/python
, you will be able to find out that this is a symlink to the default version of python.
You can edit through alternatives or manually make a symlink to the desired version.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question