如何在macos上升级到python 3.6.4?

时间:2018-01-15 17:11:28

标签: python python-3.x macos

我正在尝试使用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.
>>> 

即使我已经安装了它,但我也无法通过输入python3来使用它。我该如何解决这个问题?我想删除3.6.2并将python3映射到3.6.4。

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

由于您的python3未与自制网站相关联,因此您应该让自制程序重新链接python3

rm /usr/local/bin/python3
brew unlink python3; brew link --overwrite python3
我机器上python3

链接是:

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