【问题标题】:tensorflow import error in anacondaanaconda中的tensorflow导入错误
【发布时间】:2017-06-18 21:15:10
【问题描述】:

我按照主网站中的说明在 anaconda 中安装了 tensorflow。但是“import tensorflow”仅适用于 anaconda envs 中 tensorflow 文件夹中的 python。 anaconda的python3.6没有导入tensorflow。

【问题讨论】:

    标签: tensorflow


    【解决方案1】:

    我也面临类似的挑战 以下方式对我有用

    第一步:安装最新的anaconda

    第 2 步: C:> conda create -n tensorflow python=3.5

    虽然你的 anaconda python 是 3.6 tensorflow 可以在 3.5 上运行

    第 3 步: C:> 激活张量流

    (tensorflow)C:> # 你的提示应该改变

    第四步:

    4.1 : CPU 命令

    (tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp35-cp35m-win_amd64.whl

    4.2 : GPU 命令

    (tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.2.1-cp35-cp35m-win_amd64.whl

    第五步(验证安装tensorflow)

    (启动新终端)

    $ python
    (enter the following command)
    >>> import tensorflow as tf
    >>> hello = tf.constant('Hello, TensorFlow!')
    >>> sess = tf.Session()
    >>> print(sess.run(hello))
    the output should be 
    Hello, TensorFlow!

    第六步: 打开 Anaconda 导航器 将应用程序从“Root 更改为 Tensorflow”通道(左上角)

    第 7 步: 现在安装您希望使用的所需的 jupyter 或 spyder (安装后启动笔记本就可以了)

    【讨论】:

      【解决方案2】:

      执行安装步骤,但将 3.5 或 35 替换为 3.6 或 36。对我有用。

      conda create -n tensorflow python=3.6 
      activate tensorflow
      pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp36-cp36m-win_amd64.whl 
      

      参考:Installing TensorFlow on Windows

      【讨论】:

        猜你喜欢
        • 2019-05-02
        • 1970-01-01
        • 1970-01-01
        • 2017-08-30
        • 2019-10-12
        • 1970-01-01
        • 1970-01-01
        • 2018-11-11
        • 2016-08-11
        相关资源
        最近更新 更多