【问题标题】:Cannot install Tensorflow on PyCharm无法在 PyCharm 上安装 TensorFlow
【发布时间】:2020-10-11 22:55:47
【问题描述】:

我正在尝试在 Project > Python Interpreter 的 PyCharm 上安装 TensorFlow,以满足 TF 开发人员证书考试的要求。

我的电脑是Windows 10。在Python Console,我打印python版本:

>>> print(sys.version)
3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)]

然后我去File > Settings > Project > Python Interpreter > Available Packages,找到并安装Tensorflow包。我安装了默认版本2.2.0。我的pip 版本是20.1.1

但我无法安装它,它显示此错误:

Error occurred:
    ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)

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

我已经搜索过这个解决方案,但我找不到任何可以帮助我解决它的东西。有谁知道如何解决这一问题?谢谢。

更新: 当我在我的cmd中安装TF时,它安装成功。

C:\Users\User>pip show tensorflow
Name: tensorflow
Version: 2.2.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: c:\users\user\anaconda3\lib\site-packages
Requires: six, google-pasta, wrapt, astunparse, gast, wheel, scipy, absl-py, numpy, tensorboard, termcolor, grpcio, h5py, keras-preprocessing, tensorflow-estimator, protobuf, opt-einsum
Required-by:

更新 2:

我按照 TF 的设置说明进行操作:Link

更新 3:

所以我尝试通过包位置安装,但它不起作用(仅限 Python 3.7 CPU):

pip install https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.2.0-cp37-cp37m-win_amd64.whl

错误:

ERROR: tensorflow_cpu-2.2.0-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.

更新 4:

我新建一个项目,然后使用conda环境安装TF。然后就可以了。

但我还是不明白为什么使用普通的venv,它无法安装。

更新 5:

当 TF 关注 instruction 时,在 Ubuntu 上一切正常。

【问题讨论】:

  • 由于某种原因,在安装过程中似乎没有将版本传递给 pip。您是否尝试过使用 pip 手动安装 TensorFlow?
  • @PavelBotsman 我刚刚使用 cmd 安装了它,没有创建虚拟环境,它安装成功。你可以查看我的更新。
  • 我建议使用Python3.6安装Tensorflow
  • @Saeed 我不能使用 Python 3.6,因为 TF 开发人员证书考试需要 Python 3.7。

标签: python tensorflow pycharm


【解决方案1】:

我在安装了多个 Python 版本的情况下尝试在 Windows 10 上使用 TensorFlow 时遇到了这个问题。
我所做的是卸载除最新版本之外的所有版本。如果我需要旧版本,我会使用Conda 虚拟环境。

【讨论】:

  • 是的,没错。我必须使用conda 来安装它。它只是不适用于venv
  • 欢迎来到 SO。感谢您的洞察力/经验。虽然它可能被证明是有帮助的,但请理解,根据 SO 指南,这读起来更像是评论而不是答案,因此它可能会被平台删除(作为答案)。如果您认为可以将其变成更完整、更独立、更严格、更高质量的答案,请随意编辑。一旦你有足够的声誉,你可以评论任何帖子。 StackOverflow.com/help 有更多关于本网站格式指南的信息。我们感谢您的贡献并期待更多。
  • @SherylHohman 感谢您的澄清。感谢您的努力。
猜你喜欢
  • 2020-10-12
  • 2018-11-11
  • 2020-05-18
  • 1970-01-01
  • 2016-08-28
  • 2019-11-10
  • 2022-10-07
  • 2020-12-12
  • 1970-01-01
相关资源
最近更新 更多