Python pip3:找不到命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48014769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
pip3: command not found
提问by Makoto Miyazaki
I want to install Tensorflow following this instructions. https://www.tensorflow.org/versions/r0.12/get_started/os_setup#pip_installation.
我想按照此说明安装 Tensorflow。 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.
所以我安装了 Homebrew 并尝试卸载并重新安装 pip-3,但没有奏效。
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.
我应该怎么做才能获得 pip3?我的操作系统是 macOS High Sierra,我已经安装了 python 3.6.2。
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...
我也试过哪个 pip3,但我不知道它是否有效......
MakotonoMacBook-ea:~ makotomiyazaki$ sudo which pip3 install --upgrade $TF_BINARY_URL
/usr/bin/install
回答by Ali Nobari
You would need to install pip3.
您需要安装 pip3。
On Linux, the command would be: sudo apt install python3-pip
On Mac, using brew, first brew install python3
Then brew postinstall python3
在 Linux 上,命令是:sudo apt install python3-pip
在 Mac 上,使用 brew,首先brew install python3
然后brew postinstall python3
Try calling pip3 -V
to see if it worked.
试着打电话pip3 -V
看看它是否有效。
回答by Pravin
its possible if you already have a python installed (pip) you could do a upgrade on mac by
如果您已经安装了python(pip),则可以通过以下方式在mac上进行升级
brew upgrade python
回答by 3141
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.
编写整个路径/目录,例如。(对于窗户)C:\Programs\Python\Python36-32\Scripts\pip3.exe install mypackage
。当我在使用 pip 时遇到问题,这对我很有效。
回答by See
Try this if other methods do not work:
如果其他方法不起作用,请尝试此操作:
- brew install python3
- brew link --overwrite python
- brew postinstall python3
- 酿造安装python3
- 酿造链接--覆盖python
- 酿造后安装python3