How can I make the “python” command in terminal, run python3 instead of python2?

后端 未结 6 1784
天涯浪人
天涯浪人 2020-12-31 03:53

I\'m just starting to learn Python and did search around a little, so forgive me if this has been asked and answered.

When running scripts through the command line/t

6条回答
  •  情深已故
    2020-12-31 04:21

    According to PEP-394,
    "for the time being, all distributions should ensure that python refers to the same target as python2".
    On *nix systems, there are three links to executables of python command line interpreter named python, python2 and python3 in directory /usr/bin. The python link points to python2 according to the PEP, but you can change it to point to python3 by creating a new link to python3 and renaming it to python. Also, you have to delete the old python link.

提交回复
热议问题