#πŸ”’ python3 vs python (command)

13 messages Β· Page 1 of 1 (latest)

golden osprey
#

Hi, I have a quick question about Python on Ubuntu. By default, Ubuntu comes with Python 3 installed. However, many documentation resources still refer to Python 3 as simply "python." Given that Python 2 is no longer supported and Python 3 is the standard version, what is the best approach: Should I change the alias of python3 to python to streamline my workflow, considering that Python 2 is not widely used anymore?

keen sinewBOT
#

@golden osprey

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

inland heart
#

Is it still python version 2.7 if you run python --version?

drowsy crescent
#

I mean for convenience change the one u use to python except if its the name of the pre installed one i wouldn't mess with that

inland heart
#

If it's 2.7, I'd probably add these lines to ~/.bashrc

alias python="python3"
alias pip="python3 -m pip"
golden osprey
amber crescent
#

i don't have much knowledge in this, but the package description of python-is-python3 seems relevant:

Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal) releases, all python packages use explicit python3 or python2 interpreter and do not use unversioned /usr/bin/python at all. Some third-party code is now predominantly python3 based, yet may use /usr/bin/python.
This is a convenience package which ships a symlink to point the /usr/bin/python interpreter at the current default python3. It may improve compatibility with other modern systems, whilst breaking some obsolete or 3rd-party software.

golden osprey
amber crescent
#

i normally use pyenv for managing user installs of python, and it adds a python shim alongside python3

inland heart
golden osprey
keen sinewBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.