[conspire] Running Python 3

Rick Moen rick at linuxmafia.com
Sat Jul 7 12:02:12 PDT 2018


Quoting Elise Scher (elise.scher01 at gmail.com):

> Hi Mignon
>     I do have Python 3 on my system. In googling around, I saw that there
> is some way to make Python 3.5 the system default, instead of Python 2. I
> would like to do that.
>      Thanks for the help.

Hi, Elise!  I see you figured out the best solution (use a custom
shebang line), but I wanted to also give a word of caution about the
initial question you posed (above).  Changing the system interpreter for
Python (or Perl) scripts seems like a good idea at first glance -- and
certainly can be done -- but runs the risk of invisibly breaking system
scripts (including but not limited to system maintenance cron jobs) that 
rely on particular interpreter behaviour.  So, it's generally a bad
idea, and the alternate solution you found is accordingly one often
recommended.

Another recommended way (that you might prefer) would be to put 

  alias python=python3

or 

  alias python=/usr/bin/python3

into your ~/.bash_aliases file , and then do '. ~/.bash_aliases' to
re-run it.  The effect of that change is to alter the default Python
interpreter for _your user only_, without altering the system.

Use that second method if you're certain that all of your personal
Python scripts are going to be Python 3-compliant going forward, and
don't want the small hassle of using a custom shebang line.





More information about the conspire mailing list