【问题标题】:Unable to install tensor flow with pip?无法使用 pip 安装 tensorflow?
【发布时间】:2020-11-16 12:41:21
【问题描述】:

我刚刚更新了最新的 MacOS,它清除了所有内容。

我按照this website的步骤进行操作。

我开始使用 pip3 重新安装 tensorflow,但它没有安装任何东西。

我在输入 pip3 install --user --upgrade tensorflow 时收到此错误。

ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

仅供参考,我的 MacBook 是 64 位的。 和

~ pip3 -V
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 20.2.4 from /Users/zack/Library/Python/3.8/lib/python/site-packages/pip (python 3.8)

~ python3 -V
Python 3.8.2

我不知道发生了什么,有人有什么想法吗。

【问题讨论】:

  • 您好,您可以运行pip3 -Vpython3 -V 吗?
  • @pavelbere 我刚刚更新了。
  • python3 -c "from pip._internal.utils.compatibility_tags import get_supported; print(get_supported()[0])" 的输出是什么?确实可能是因为大的sur更新;我将我的 macbook 的升级至少推迟到 2.4.0 发布。

标签: tensorflow pip


【解决方案1】:

根据本文档https://www.tensorflow.org/install/pip#package-location 以及你应该运行的 python 版本

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.3.0-cp38-cp38-macosx_10_14_x86_64.whl

这是第 3 步,因此请检查您是否正确安装了第 1 步和第 2 步中的软件包

【讨论】:

  • 我收到一个新错误ERROR: tensorflow-2.3.0-cp38-cp38-macosx_10_14_x86_64.whl is not a supported wheel on this platform.
【解决方案2】:

如果 pip 不是最新的升级 pip:

pip install --upgrade pip

然后安装张量流:

pip install tensorflow

对于python 3.8,您需要安装tensorflow 2.2 或更高版本

tensorflow的系统要求:

Python 3.5–3.8 Python 3.8 支持需要 TensorFlow 2.2 或更高版本。

pip 19.0 或更高版本(需要 manylinux2010 支持)

Ubuntu 16.04 或更高版本(64 位)

macOS 10.12.6 (Sierra) 或更高版本(64 位)(不支持 GPU)

【讨论】:

  • 我认为问题出在 macOS Big Sur 上。