【问题标题】:Cannot import tensorflow in python after source build源构建后无法在python中导入tensorflow
【发布时间】:2015-12-13 11:26:28
【问题描述】:

我正在尝试在 linux 机器上安装带有 cuda 和 cudnn 的 tensorflow。我没有 sudo 访问权限,所以我是从源代码构建的。我在这里按照说明操作:https://www.tensorflow.org/versions/master/get_started/os_setup.html#source

我得到了我们得到大量输出的部分:

This tutorial iteratively calculates the major eigenvalue of a 2x2 matrix, on GPU.
The last few lines look like this.
000009/000005 lambda = 2.000000 x = [0.894427 -0.447214] y = [1.788854 -0.894427]
000006/000001 lambda = 2.000000 x = [0.894427 -0.447214] y = [1.788854 -0.894427]

但是在那之后,当我打开python并尝试导入tensorflow时,它说没有这样的模块。

提前致谢。

【问题讨论】:

  • 另外,我不明白为什么我们只在这一行中构建 example_trainer: bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer 我们不应该构建整个包?

标签: python-2.7 tensorflow


【解决方案1】:

在 Python shell 中导入 TensorFlow 之前,您需要执行更多步骤:仅构建 //tensorflow/cc:tutorials_example_trainer 不会构建任何 Python 前端。

从源安装执行此操作的最简单方法是遵循instructions for building a PIP package from source,然后安装它(在您的计算机上全局安装,或在virtualenv 中)。

【讨论】:

猜你喜欢
  • 2018-04-29
  • 2021-10-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-14
  • 1970-01-01
  • 2018-06-12
相关资源
最近更新 更多