【问题标题】:Install Tensorflow 2.x only for CPU using PIP仅使用 PIP 为 CPU 安装 Tensorflow 2.x
【发布时间】:2020-07-26 06:00:25
【问题描述】:

如何使用 pip 仅安装 CPU 版本的 Tensorflow 2.x? 过去,可以安装这 2 个不同的版本。

由于我在 nonen GPU 设备中运行脚本(没有 envidia 卡,没有 cuda 支持的 intel 卡可用),我收到以下错误:

2020-04-14 23:28:14.632879:W tensorflow/stream_executor/platform/default/dso_loader.cc:55] 无法加载动态库“libcuda.so.1”; dlerror:libcuda.so.1:无法打开共享对象文件:没有这样的文件或目录 2020-04-14 23:28:14.632902:E tensorflow/stream_executor/cuda/cuda_driver.cc:313] 调用 cuInit 失败:未知错误 (303)

过去我的解决方法是使用仅 CPU 版本。

提前感谢您的提示

【问题讨论】:

  • 这不是错误,只是警告,忽略它,tensorflow 将在 CPU 中运行。
  • 没有这样的文件或目录 2020-04-14 23:28:14.632902: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] 调用 cuInit 失败:未知错误 (303)。这是一个错误,过去我只是得到一个 W 并且我忽略了它。

标签: tensorflow installation tensorflow2.x


【解决方案1】:

安装仅 CPU 版本后问题已解决。

我使用了 pin tensorflow-cpu 和 release 版本。不知何故,CPU 的后备解决方案在我的设置中不起作用。

【讨论】:

    【解决方案2】:

    您可以根据您的 python 版本选择仅 CPU 版本的 tensorflow。 在此处查看列表: https://www.tensorflow.org/install/pip#package-location

    例如对于 Python 3.8,您需要执行以下操作:

    pip3 install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.3.0-cp38-cp38-manylinux2010_x86_64.whl
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-25
      相关资源
      最近更新 更多