pip3: command not found

北城余情 提交于 2019-12-20 10:33:32

问题


I want to install Tensorflow following this instructions. https://www.tensorflow.org/versions/r0.12/get_started/os_setup#pip_installation.

But when I try this code on terminal, it returns an error.

$ sudo pip3 install --upgrade $TF_BINARY_URL
sudo: pip3: command not found

So I installed Homebrew and tried to uninstall and reinstall pip-3, but didn't work.

MakotonoMacBook-ea:~ makotomiyazaki$ brew uninstall python3-pip
Error: No such keg: /usr/local/Cellar/python3-pip

MakotonoMacBook-ea:~ makotomiyazaki$ brew install python3-pip
Error: No available formula with the name "python3-pip" 
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

What should I do for getting pip3? My OS is macOS High Sierra, and I have python 3.6.2 already installed.

EDIT: I tried

python3 -m pip

and what's returned was this.

The directory '/Users/makotomiyazaki/Library/Caches/pip/http' or its 
parent directory is not owned by the current user and the cache has 
been disabled. Please check the permissions and owner of that 
directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/makotomiyazaki/Library/Caches/pip' or its parent 
directory is not owned by the current user and caching wheels has been 
disabled. check the permissions and owner of that directory. If 
executing pip with sudo, you may want sudo's -H flag.
You must give at least one requirement to install (see "pip help 
install")

I also tried which pip3, but just I don't know if it worked...

MakotonoMacBook-ea:~ makotomiyazaki$ sudo which pip3 install --upgrade $TF_BINARY_URL
/usr/bin/install

回答1:


You would need to install pip3.

On Linux, the command would be: sudo apt install python3-pip

On Mac, using brew, first brew install python3
Then brew postinstall python3

Try calling pip3 -V to see if it worked.




回答2:


Writing the whole path/directory eg. (for windows) C:\Programs\Python\Python36-32\Scripts\pip3.exe install mypackage. This worked well for me when I had trouble with pip.




回答3:


its possible if you already have a python installed (pip) you could do a upgrade on mac by

brew upgrade python



回答4:


Try this if other methods do not work:

  1. brew install python3
  2. brew link --overwrite python
  3. brew postinstall python3


来源:https://stackoverflow.com/questions/48014769/pip3-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!