0

i want to port Python Scripts to python 3. How can i force Ubuntu to use python 3 instead of python 2 which is installed, as well.

Due to the size of the project, i'd prefer not to write something like 'use python3' inside the scripts.
Deinstalling python 2 isn't an option too, because there are to many dependencies.

So, can i remove Python 2 from the path for a while or something, so that python scripts are called with Python 3 by default.

Ubuntu 15.10

b-boy
  • 31

1 Answers1

4

Option 1:

Just put #!/usr/bin/env python3 on top of each script file.

Due to the size of the project, i'd prefer not to write something like 'use python3' inside the scripts.

It's just one line, it can't increase the size of the project much. Writing this is a standard UNIX and Python convention.

Option 2:

Just call the script with python3 instead of python.