MacOS stil points to python3.6

Viewed 79

I can confirm I installed python3.8

brew install python
Warning: python@3.8 3.8.5 is already installed and up-to-date
To reinstall 3.8.5, run `brew reinstall python@3.8

However, macOS still points to python3.6

$python --version
Python 3.6.8 :: Anaconda, Inc.

$ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 29 2018, 19:04:46)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

What's the workaround to point to version 3.8?

2 Answers

Pretty certain the simple fix here since your path is small is to get rid of the

/anaconda3/bin and /Users/Sani/anaconda3/bin in your PATH variable.

Try this:

export PATH=$(p=$(echo $PATH | tr ":" "\n" | grep -v "/anaconda3/bin" | tr "\n" ":"); echo ${p%:}) We are taking whatever is inside the grep command and removing it

export PATH=$(p=$(echo $PATH | tr ":" "\n" | grep -v "/Users/sani/anaconda3/bin" | tr "\n" ":"); echo ${p%:})

You may need to restart your terminal to see if it changed. I assume the Python3.6 is being picked up through the Anaconda bins.

Otherwise yes uninstalling Anaconda3 will solve your problem.

I have found a way out

conda install python=3.8

works for me.

$ python
Python 3.8.3 (default, Jul  2 2020, 11:26:31) 
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Related