Home > Blockchain >  unable to update python
unable to update python

Time:03-30

When I type python --version, the output is "Python 2.7.18" I tried python3 --version, and the output is Python 3.10.4, how can update python to 3.10 without creating python 3?

I was expecting python's version to be 3.10.x and I tried brew upgrade, it didn't work. I'm on mac montery btw

CodePudding user response:

Try this

`vi ~/.bash`

Then type out

alias python=python3

Save your file by pressing Esc -> type :wq

Then to update your shell environment

source ~/.bash

Another way you could try if you know what you are doing, is to go straight to your .bash_profile or .bashrc and write direct into it:

export PATH="/usr/local/opt/[email protected]/libexec/bin:$PATH"

change X and Y to your python version

CodePudding user response:

Linux based system comes with Python 2 pre-installed for compatibility with legacy software. It's not recommended to make changes on it yourself. You might be breaking something.

For now, if you want to use Python 3, your option is to use the python3 command.

Alternatively, you may try the recently released (march, 14th) macOS Monterey 12.3. Acordinly to it's Release Notes, they are dropping the python 2 from the system. In this case, you should be able to safely install Python 3 and use it as just python at the command line.

Alternatively, you can try the recently released macOS Monterey 12.3 (March 14). According to their Release Notes, they are taking Python 2 out of the system. In that case, you can install Python 3 and just use it as python from the command line.

  • Related