【问题标题】:How to install tensorflow-gpu 1.12 with CUDA 10.0如何使用 CUDA 10.0 安装 tensorflow-gpu 1.12
【发布时间】:2018-12-03 10:10:39
【问题描述】:

我知道tensorflow-gpu==1.12 需要 CUDA 9.0 或更低版本,但我可以在CUDA 10.0 上安装 Tensorflow 吗?可能是通过来源或使用Bazel

更新:我尝试从 Github 下载并通过 Bazel 安装,但出现以下错误。

Python 3.7.1 (default, Oct 23 2018, 19:19:42) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "/some-folder/tensorflow-1.12.0/tensorflow/python/platform/self_check.py", line 25, in <module>
    from tensorflow.python.platform import build_info
ImportError: cannot import name 'build_info' from 'tensorflow.python.platform' (unknown location)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/some-folder/tensorflow-1.12.0/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/some-folder/tensorflow-1.12.0/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/some-folder/tensorflow-1.12.0/tensorflow/python/pywrap_tensorflow.py", line 25, in <module>
    from tensorflow.python.platform import self_check
  File "/some-folder/tensorflow-1.12.0/tensorflow/python/platform/self_check.py", line 27, in <module>
    raise ImportError("Could not import tensorflow. Do not import tensorflow "
ImportError: Could not import tensorflow. Do not import tensorflow from its source directory; change directory to outside the TensorFlow source tree, and relaunch your Python interpreter from there.

【问题讨论】:

  • “不要从其源目录导入 tensorflow;” 听起来很重要的建议
  • TensorFlow 尚不支持 Python 3.7,需要切换到 Python 3.6,然后从源代码构建以获得 CUDA 10 支持。见:medium.com/@vitali.usau/…

标签: tensorflow deep-learning open-source


【解决方案1】:

tensorflow 不支持 python 3.7 版本。 需要 Python 3.4、3.5 或 3.6

见下文 https://www.tensorflow.org/install/pip

【讨论】:

    【解决方案2】:

    我们只需要从源目录中出来并运行 python 文件。如果您使用python filename.py 命令运行文件,则需要将文件移到源目录之外。

    当您从源目录中使用 import tensorflow 时,它将导入文件夹 tensorflow 而不是实际的 tensorflow 库

    【讨论】:

      猜你喜欢
      • 2019-06-04
      • 2017-02-10
      • 2016-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多