简体   繁体   English

如何在macos上升级到python 3.6.4?

[英]How to upgrade to python 3.6.4 on macos?

I'm trying to use python 3.6.4: 我正在尝试使用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 . 即使我已经安装了它,我也不能通过输入python3来使用它。 How do I solve this? 我该如何解决这个问题? I want to remove 3.6.2 and have python3 map to 3.6.4. 我想删除3.6.2并将python3映射到3.6.4。

As your python3 is not linked to homebrew one, you should let homebrew force relink python3 : 由于你的python3没有链接到自制的,你应该让homebrew force重新链接python3

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

link of python3 on my machine is: 我机器上python3链接是:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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