简体   繁体   中英

How to upgrade to python 3.6.4 on macos?

I'm trying to use python 3.6.4:

n155-p250:Desktop sahandzarrinkoub$ brew upgrade python3
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
bash-preexec        jenkins             presto              ttf2eot
cppcheck            khard               qpdf                txr
docker-gen          lz4                 scummvm             unixodbc
duplicity           mdp                 scummvm-tools       verilator
get-flash-videos    mycli               sslsplit
get_iplayer         ola                 tin
gobuster            ponyc               tokei

Error: python3 3.6.4_2 already installed
n155-p250:Desktop sahandzarrinkoub$ python3
Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Even though I already have it installed, I can't use it by typing python3 . How do I solve this? I want to remove 3.6.2 and have python3 map to 3.6.4.

As your python3 is not linked to homebrew one, you should let homebrew force relink python3 :

rm /usr/local/bin/python3
brew unlink python3; brew link --overwrite python3

link of python3 on my machine is:

/usr/local/bin/python3 -> ../Cellar/python3/3.6.4/bin/python3

更新终端中的python run brew update (这将更新Homebrew)然后brew upgrade python3最后你可以运行brew cleanup python3来删除旧版本

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM