无法在Mojave中酿造升级Python

时间:2019-01-14 18:59:13

标签: python homebrew permission-denied macos-mojave

我在macOS Mojave 10.14.2中运行了brew outdated,并确定pythonpython@2已过时。当我运行brew upgrade时,两者都失败了。例如python@2

==> Upgrading python@2 
==> Downloading https://homebrew.bintray.com/bottles/python@2-2.7.15_2.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring python@2-2.7.15_2.mojave.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

我运行了brew doctor,建议您运行brew link,但这仍然失败,并出现相同的权限错误:

Linking /usr/local/Cellar/python@2/2.7.15_2... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

This post建议向父目录授予特权,但是我想了解为什么会发生这种情况并找到学习的解决方案。

1 个答案:

答案 0 :(得分:0)

我找到了答案here。根据该帖子,我必须先sudo mkdir /usr/local/Frameworks创建丢失的目录,然后再创建sudo chown -R $(whoami) $(brew --prefix)/*,因为sudo chown -R $(whoami) /usr/local在Mojave和High Sierra中不再可用。之后我可以brew link pythonbrew link python@2