簡體   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