brew install python3

brew install python3
此时,安装完成后会出现一点问题:

liyang@liyang  ~  brew install python3
Updating Homebrew…
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/php).
==> Updated Formulae
homebrew/php/adminer homebrew/php/drupalconsole
==> Installing dependencies for python3: gdbm
==> Installing python3 dependency: gdbm
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/gd

################################################################## 100.0%

==> Pouring gdbm-1.14.1_1.high_sierra.bottle.tar.gz
�� /usr/local/Cellar/gdbm/1.14.1_1: 20 files, 555.7KB
==> Installing python3
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/py

################################################################## 100.0%

==> Pouring python3-3.6.4_2.high_sierra.bottle.tar.gz
Error: An unexpected error occurred during the brew link step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
✘ liyang@liyang  ~  ls /usr/local/Frameworks
ls: /usr/local/Frameworks: No such file or directory
此时会发现两个错误,第一个是权限问题,第二个是/usr/local/Frameworks目录不存在。
首先,我们先解决目录不存在的问题

sudo mkdir /usr/local/Frameworks
创建目录以后,我们开始解决权限问题,通过Google,发现大多数处理方法都是

sudo chown $(whoami):admin /usr/local/
虽然能解决问题,但并不是一个好的idea~,这里非常不建议使用,那么解决方案入下:

sudo chown -R ( w h o a m i ) (brew –prefix)/*
此时,上面两个问题就已经安装完成,只需要最后一步link一下即可。

brew link python3
Linking /usr/local/Cellar/python3/3.6.4_2… 1 symlinks created
此时python3就已经安装完成(/usr/local/Cellar/),以后可以使用brew来更新了~

参考链接

https://github.com/Homebrew/homebrew-core/issues/19286
https://stackoverflow.com/questions/16432071/how-to-fix-homebrew-permissions

猜你喜欢

转载自blog.csdn.net/commshare/article/details/79357171