tensorflow pip3:未找到命令

p3rjfoxz  于 2023-04-12  发布在  其他
关注(0)|答案(7)|浏览(198)

我想按照以下说明安装TensorFlow:https://web.archive.org/web/20170627102751/https://www.tensorflow.org/versions/r0.12/get_started/os_setup#pip_installation
但是当我在终端上尝试这段代码时,它返回一个错误。

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

所以我安装了Homebrew,并试图卸载和重新安装python3-pip,但没有工作。

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

我的操作系统是macOS High Sierra,我已经安装了Python 3.6.2。
曲名:I Try

python3 -m pip

结果是这样的

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")

我也试过pip 3,但只是我不知道它是否工作...

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

6kkfgxo01#

你需要安装pip3。
在Linux上,首先运行sudo apt update。然后命令为:sudo apt install python3-pip
在Mac上,使用brew,首先brew install python3
然后brew postinstall python3
试着调用pip3 -V来看看它是否工作。

kninwzqo

kninwzqo2#

我有这个问题,我修复了它使用以下步骤您需要使用完全卸载python3-pip:

sudo apt-get --purge autoremove python3-pip

然后重新安装 Package :

sudo apt install python3-pip

要确认一切正常,请运行:

pip3 -V

在此之后,您现在可以使用pip 3来管理您感兴趣的任何python包。

pip3 install NumPy
kse8i1jr

kse8i1jr3#

写入整个路径/目录例如(对于windows)C:\Programs\Python\Python36-32\Scripts\pip3.exe install mypackage。当我遇到pip问题时,这对我很有效。

93ze6v8z

93ze6v8z4#

如果你已经安装了python(pip),你可以在mac上通过

brew upgrade python
vbopmzt1

vbopmzt15#

如果其他方法不起作用,请尝试以下操作:

  1. brew安装python3
  2. brew link --overwrite python
  3. brew postinstall python
tjjdgumg

tjjdgumg6#

在我的例子中,虽然已经安装了python3-pip,但它不能识别pip 3。
sudo yum reinstall python3-pip
它工作得很好,并识别pip 3命令。

gkl3eglg

gkl3eglg7#

yum install python3-pip之后,检查安装的二进制文件的名称。

ll /usr/bin/pip*

在我的CentOS 7上,它被命名为pip-3而不是pip3

相关问题