简体   繁体   English

无法通过Homebrew安装Python3

[英]Unable to install Python3 via Homebrew

I want to install python 3 via Homebrew. 我想通过Homebrew安装python 3。 Here is the error I get: 这是我得到的错误:

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

Now when I do 'brew link xz gdbm' I get this: 现在,当我执行“ brew link xz gdbm”时,得到以下信息:

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

I tried the following options to fix this: 我尝试了以下选项来解决此问题:

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 ...

After this I tried to install python3 again but I am getting the same error. 在此之后,我尝试再次安装python3,但出现相同的错误。 Please help. 请帮忙。

/usr/local/include is not writable.

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

您要添加的目录为/ usr / local / include或/ usr / local正确的目录。

I had the same problems. 我有同样的问题。 Run

brew doctor

(probably you also need to update brew if it's old with command brew update) and after warnings are cleared python installation should move forward without a hitch. (如果使用brew brew update命令较旧,可能还需要更新brew),并且在清除警告后,python安装应该会顺利进行。

Please note you can run brew doctor as many times until all warnings are gone. 请注意,在所有警告消失之前,您可以运行啤酒医生多次。

run

    brew doctor

then you'll see a diagnosis like this: 那么您将看到如下诊断:

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

it means you can fix by running this code: 这意味着您可以通过运行以下代码进行修复:

 brew link makedepand

so now this works. 所以现在这有效。

 brew install pyenv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM