前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Tensorflow 源码安装成功,导入报错 ImportError: cannot import name 'build_info'

Tensorflow 源码安装成功,导入报错 ImportError: cannot import name 'build_info'

作者头像
用户1148525
发布2019-05-26 11:49:46
4.5K0
发布2019-05-26 11:49:46
举报

ImportError: cannot import name ‘build_info’

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

https://github.com/tensorflow/tensorflow/issues/13526

Installing collected packages: setuptools, numpy, tensorflow Found existing installation: setuptools 40.6.2 Uninstalling setuptools-40.6.2: Successfully uninstalled setuptools-40.6.2 Found existing installation: numpy 1.15.4 Uninstalling numpy-1.15.4: Successfully uninstalled numpy-1.15.4 Successfully installed numpy-1.14.5 setuptools-39.1.0 tensorflow-1.10.1 zhangjun@zhangjun-desktop:~/tensorflow$ python Python 3.5.2 (default, Nov 12 2018, 13:43:14) [GCC 5.4.0 20160609] on linux Type “help”, “copyright”, “credits” or “license” for more information. import tensorflow as tf Traceback (most recent call last): File “/home/zhangjun/tensorflow/tensorflow/python/platform/self_check.py”, line 25, in from tensorflow.python.platform import build_info ImportError: cannot import name ‘build_info’

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “”, line 1, in File “/home/zhangjun/tensorflow/tensorflow/init.py”, line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File “/home/zhangjun/tensorflow/tensorflow/python/init.py”, line 49, in from tensorflow.python import pywrap_tensorflow File “/home/zhangjun/tensorflow/tensorflow/python/pywrap_tensorflow.py”, line 25, in from tensorflow.python.platform import self_check File “/home/zhangjun/tensorflow/tensorflow/python/platform/self_check.py”, line 27, in 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. exit()

如何解决这个报错? 换个路径使用就可以了!

zhangjun@zhangjun-desktop:~/tensorflow$ cd zhangjun@zhangjun-desktop:~$ python Python 3.5.2 (default, Nov 12 2018, 13:43:14) [GCC 5.4.0 20160609] on linux Type “help”, “copyright”, “credits” or “license” for more information. import tensorflow import tensorflow as tf hello = tf.constant(‘Hello, TensorFlow!’) sess = tf.Session() 2018-12-04 08:46:22.637049: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:897] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2018-12-04 08:46:22.637463: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties: name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582 pciBusID: 0000:01:00.0 totalMemory: 10.91GiB freeMemory: 10.45GiB 2018-12-04 08:46:22.637479: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0 2018-12-04 08:46:22.822172: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix: 2018-12-04 08:46:22.822203: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0 2018-12-04 08:46:22.822209: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0: N 2018-12-04 08:46:22.822422: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10106 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1) print(sess.run(hello)) b’Hello, TensorFlow!’

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018年12月04日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档