Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
182 views
in Technique[技术] by (71.8m points)

Installed Python 3.9.1 onto MAC OS but still says Python version is 2.7

I installed Python 3.9.1 onto my MacBook however when I use the command python --version it says its python 2.7. Here's what going on in my terminal for reference:

$ python -V
Python 2.7.16
$ brew install pyenv
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from 565becc90 to e41981a5c.
Updated 1 tap (homebrew/core).
==> New Formulae
htmltest                   mpdecimal                  vitess
==> Updated Formulae
Updated 158 formulae.

==> Homebrew was updated to version 2.7.7
The changelog can be found at:
  https://github.com/Homebrew/brew/releases/tag/2.7.7
Warning: pyenv 1.2.22 is already installed and up-to-date.
To reinstall 1.2.22, run:
  brew reinstall pyenv
$ pyenv install 3.9.1
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.1.tar.xz...
-> https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tar.xz
Installing Python-3.9.1...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
       
Installed Python-3.9.1 to /Users/myname/.pyenv/versions/3.9.1

$ 
$ python --version
Python 2.7.16

Thanks in advance for your help!

question from:https://stackoverflow.com/questions/65948973/installed-python-3-9-1-onto-mac-os-but-still-says-python-version-is-2-7

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You have to add /usr/local/opt/python/libexec/bin to your PATH.

Checkout Make python3 as my default python on Mac


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...