念念不忘
必有回响🎉

使用brew安装Python3

卸载完dmp文件安装的python3后,我们需要重新安装当前稳定版的python3(python 3.6.4)

brew install python3

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

 [email protected]  ~  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
 ✘ [email protected]  ~  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 $(whoami) $(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
赞(0) 打赏
未经允许不得转载:Charles's Blog » 使用brew安装Python3

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏