ModuleNotFoundError:anaconda python 3.6.3中没有名为’tensorflow’的模块

ModuleNotFoundError: No module named ‘tensorflow’ in anaconda python 3.6.3

我使用python 3.6.3 anaconda自定义(64位)Ubuntu 16.04 64位。我安装了TensorFlow。我执行了以下步骤:

  • conda create-n tensorflow pip python=3.6
  • 源激活张量流
  • pip安装–忽略已安装–升级https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0-cp36-cp36m-linux_x86_64.whl
  • 我有一个TensorFlow的导入错误:

    moduleNotfoundError回溯(最近调用的最后一个)

    在()-->1将TensorFlow导入为tf

    moduleNotfoundError:没有名为"tensorflow"的模块

    如何解决?谢谢


    当你使用Python时,如果可能的话,最好使用Python安装工具。

    1
    2
    source activate tensorflow
    conda install tensorflow

    它将显示如下内容:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    Fetching package metadata .......
    Solving package specifications: ..........

    Package plan for installation in environment
    /usr/local/anaconda3/envs/tensorflow:

    The following NEW packages will be INSTALLED:

    backports:              1.0-py36_0          
    backports.weakref:      1.0rc1-py36_0      
    bleach:                 1.5.0-py36_0        
    html5lib:               0.9999999-py36_0    
    libprotobuf:            3.4.0-0            
    markdown:               2.6.9-py36_0        
    mkl:                    2017.0.3-0          
    numpy:                  1.13.1-py36_0      
    protobuf:               3.4.0-py36_0        
    six:                    1.10.0-py36_0      
    tensorflow:             1.3.0-0            
    tensorflow-base:        1.3.0-py36h5293eaa_1
    tensorflow-tensorboard: 0.1.5-py36_0        
    werkzeug:               0.12.2-py36_0      

     Proceed ([y]/n)? y

    Linking packages ...
    [      COMPLETE      ]

    然后,您应该能够成功导入TensorFlow

    1
    2
    3
    4
    5
    6
    7
    (tensorflow) user@ubuntu: $ python

    Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 13:51:32)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
    Type"help","copyright","credits" or"license" for more information.
    >>> import tensorflow as tf
    >>>