2

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?

  • Where, if at all, is `/usr/local/bin` in your `PATH`? – chepner Aug 11 '20 at 18:21
  • `$ echo $PATH /usr/local/bin:/anaconda3/bin:/Users/Sani/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin` –  Aug 11 '20 at 18:26
  • Either you need to run `rehash` to tell the shell to look again for a version of `python` in `/usr/local/bin`, or you need to use `python3` to access the newly installed Python 3. – chepner Aug 11 '20 at 18:31
  • It finds Python3.6 in the `/anaconda3/bin` directory before it finds python in the directory in which Homebrew installed Python3.8. – Pranav Hosangadi Aug 11 '20 at 18:55

2 Answers2

0

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.

Austin
  • 174
  • 2
0

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.
>>>