Changing default python to python3

Forum Forums New users New Users and General Questions Changing default python to python3

Tagged: 

  • This topic has 1 reply, 2 voices, and was last updated Oct 18-10:37 am by Xecure.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #43197
    Member
    cup

      I only ever use python3 in my coding. By default, python points to python2. Is it feasible to change the link of python to python3? Will the OS still start if I do that?

      I don’t really want to try this unless it is certain that my system will start up. I don’t really want to go through wiping out the OS and reinstalling. I know some scripts are based on python2 but I don’t know which ones and how they affect the system.

      #43212
      Member
      Xecure
        Helpful
        Up
        0
        ::

        On the next debian release (bullseye, currently debian testing) this change has already been done. Some antiX apps have already started the migration, but its not ready yet. If you change the metapackage, it won’t break your boot, but programs like Wallpaper selector or Menu updater may be broken.

        For your python script, use this at the top of your script file
        #!/usr/bin/env python3
        That way you are sure that everything works only on python3 environment and isn’t launched using python2

        If it is too much work, you may install antiX core and upgrade to testing or directly download the sid editions and build your antiX system there (though I think this is even more work).

        Maybe someone more knowledgeable can give a better solution.

        antiX Live system enthusiast.
        General Live Boot Parameters for antiX.

        #43681
        Member
        ex_Koo
          Helpful
          Up
          0
          ::

          If you want to test a version of python or change the default version used you can add an alias in your .bashrc file.
          To find what version is your default just type

            python

          into your terminal. To exit the python prompt use ctrl+d.
          antiX default = 2.7.16

          alias python=’/usr/bin/python3.7′
          # my system now users 3.7 if you wish to go back to 2.7.16 just comment out the line or remove it from your .bashrc. remember to logout & in after making the change.

          antix1 * 16 files = 1.4M ~ >$python
          Python 3.7.3 (default, Jul 25 2020, 13:03:44)
          [GCC 8.3.0] on linux

        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.