S
S
Sergei E.2016-08-07 08:42:24
Python
Sergei E., 2016-08-07 08:42:24

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

1 answer(s)
I
Igor Nikolaev, 2016-08-07
@SmartFinn

All wrong.
#!/usr/bin/pythonenough, 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 question

Ask a Question

731 491 924 answers to any question