【问题标题】:Unable to install Python3 via Homebrew无法通过 Homebrew 安装 Python3
【发布时间】:2015-04-15 00:37:21
【问题描述】:

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

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

现在,当我执行“brew link 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,但我得到了同样的错误。请帮忙。

【问题讨论】:

  • 你为什么不直接安装 Python 3……来自 Python.org?
  • brew doctor 可能会在您将来遇到此类问题时提出解决方案。下面伊恩的回答是正确的。

标签: python python-3.x homebrew


【解决方案1】:

/usr/local/include is not writable.

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

您要 chown 的目录是 /usr/local/include,或 /usr/local 正确的。

【讨论】:

    【解决方案2】:

    我也有同样的问题。运行

    brew doctor
    

    (如果它是旧的,你可能还需要更新 brew 命令 brew update) 并且在清除警告后,python 安装应该顺利进行。

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

    【讨论】:

      【解决方案3】:

      运行

          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
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-27
        • 2020-02-22
        • 2013-08-05
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多