无法通过Homebrew安装Python3

时间:2015-04-15 00:37:21

标签: python python-3.x homebrew

我想通过Homebrew安装python 3。这是我得到的错误:

Error: You must `brew link xz gdbm' before python3 can be installed

现在,当我这样做时,请链接xz gdbm'我明白了:

Linking /usr/local/Cellar/gdbm/1.11... Error: Could not symlink include/gdbm.h/usr/local/include is not writable.

我尝试了以下选项来解决此问题:

sudo chown -R $USER /usr/local/bin/include
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
   chown [-fhv] [-R [-H | -L | -P]] :group file ...

在此之后我尝试再次安装python3但是我得到了同样的错误。请帮忙。

3 个答案:

答案 0 :(得分:3)

  

/usr/local/include is not writable.

     

sudo chown -R $USER /usr/local/bin/include

您要选择的目录是/ usr / local / include,或/ usr / local proper。

答案 1 :(得分:0)

我遇到了同样的问题。运行

brew doctor

(可能你还需要更新brew,如果它已经使用命令brew更新了) 并且在警告被清除后,python安装应该顺利前进。

请注意,您可以多次运行brew医生,直到所有警告都消失为止。

答案 2 :(得分:0)

运行

    brew doctor
然后你会看到这样的诊断:

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run brew link on these:

  makedepend

这意味着您可以通过运行此代码进行修复:

 brew link makedepand

所以现在这样做了。

 brew install pyenv