繁体   English   中英

brew install python3 没有安装 pip3

[英]brew install python3 didn't install pip3

我使用自制软件安装了 python3 但它没有安装 pip3 或者我应该说它已安装但它无法识别命令?

这是我所做的:

brew install python3

这安装了python3但最后抛出一个错误说它无法链接python3并提示我运行

brew link python3

链接安装,但这会引发另一个错误:

Linking /usr/local/Cellar/python3/3.6.3... Error: Permission denied @ dir_s_mkdir - /usr/local/lib 

有谁知道如何解决这个问题? 当我运行时:

brew info python3

它说:

==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>

They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html

这让我认为 pip3 已安装但未被识别。 任何帮助表示赞赏。

信息:

操作系统 => MacOS High Sierra 10.13.1

 pip3 install twilio
-bash: pip3: command not found

好的,我花了很多谷歌搜索,但问题是在高山脉中 usr/local 中的所有权限都改变了,自制软件必须在 usr/local 中创建一些文件夹。 这是我解决所有问题的方法:

我尝试使用sudo brew install python3但这也直接从 Homebrew 抛出了一个错误,告诉我它不允许使用sudo brew

在 /usr/local 中使用 sudo mkdir 创建我需要的文件夹:

sudo mkdir lib 
sudo mkdir Frameworks

更改 /usr/local 中的权限,以便自制软件可以访问它们:

sudo chown -R $(whoami) $(brew --prefix)/*

现在安装python3

brew install python3

这将使您成功安装:

==> Pouring python3-3.6.3.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --in
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --in
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --in
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>

They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html
==> Summary
🍺  /usr/local/Cellar/python3/3.6.3: 3,588 files, 56.1MB

解决链接问题(例如https://github.com/Homebrew/homebrew-core/issues/19286 )后,安装了 python3 但没有安装 pip3。 重新安装python(例如brew重新安装python)最终也会安装pip3。 这些步骤对我很有效。

GitHub 用户 @aether2501 评论了“Homebrew Permission Denied” 问题的 sudo chown 解决方案,建议在升级到 High Sierra 后卸载/重新安装 Homebrew。

我在 High Sierra (10.13.2) 上成功使用了 @aether2501 的重新安装命令/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"无需先卸载 brew。

除了创建 /usr/local/Frameworks 目录并设置链接 python3 所需的必要所有权和权限外,它似乎还修复了其他目录问题。

我有同样的问题并使用:

sudo -H pip3 install virtualenv
sudo -H pip3 install virtualenvwrapper --ignore-installed six

就我而言,这解决了问题:

brew unlink python@3.9; brew link python@3.9

(您可能需要用您安装的版本替换版本号)

暂无
暂无

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

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