【问题标题】:Can't import tensor flow无法导入张量流
【发布时间】:2016-08-21 16:25:52
【问题描述】:

我已经使用 pip 成功安装了 tensorflow。我有 python 2.7.11。当我执行 pip show tensorflow 时仔细检查,它显示 tensorflow 0.8.0 版本已成功安装。

但是为了测试我所做的安装

$python
import tensorflow as tf

然后我得到

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow

当我这样做时 $pip show tensorflow 我明白了

Metadata-Version: 2.0
Name: tensorflow
Version: 0.8.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
Installer: pip
License: Apache 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: six, protobuf, wheel, numpy
Classifiers:
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: Education
Intended Audience :: Science/Research
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 2.7
Topic :: Scientific/Engineering :: Mathematics
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Software Development :: Libraries
Entry-points:
[console_scripts]
tensorboard = tensorflow.tensorboard.tensorboard:main

【问题讨论】:

  • pip show tensorflow 实际打印的是什么? python -c 'import sys; print (sys.path)呢?

标签: python-2.7 ubuntu tensorflow tensorboard


【解决方案1】:

你确定当你调用 python 解释器版本 2.7 是默认的吗? 尝试在你的 shell 中输入

python -V

验证哪个版本是默认的。如果不是 2.7,请尝试输入

python2.7 -c "import tensorflow as tf"

看看有没有错误

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-25
    • 2018-10-14
    • 2019-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多