ImportError: No module named tensorflow

前端 未结 18 2300
长情又很酷
长情又很酷 2020-11-28 05:11

Please help me with this error

I have installed the tensorflow module on my server and below is it\'s information

15IT60R19@cpusrv-gpu-109:~$ pip sho         


        
相关标签:
18条回答
  • 2020-11-28 05:59

    I was trying to install tensorflow GPU for a Windows 7 with pip3 for python3.5.x. Instead of doing pip3 install --upgrade tensorflow I just did pip install tensorflow and after it completed i was finally able to import tensorflow in python3.5.x.

    0 讨论(0)
  • 2020-11-28 06:03

    Try Anaconda install steps from TensorFlow docs.

    0 讨论(0)
  • 2020-11-28 06:06

    with python2

    pip show tensorflow to check install

    python test.py to run test

    with python3

    pip3 show tensorflow to check install

    python3 test.py to run test

    test.py

    import tensorflow as tf
    import numpy as np
    
    c = np.array([[3.,4], [5.,6], [6.,7]])
    step = tf.reduce_mean(c, 1)                                                                                 
    with tf.Session() as sess:
        print(sess.run(step))
    

    Or, if you haven't install tensorflow yet, try the offical document

    0 讨论(0)
  • 2020-11-28 06:09

    I had a more basic problem when I received this error.

    The "Validate your installation" instructions say to type: python

    However, I have both 2.7 and 3.6 installed. Because I used pip3 to install tensorflow, I needed to type: python3

    Using the correct version, I could import the "tensorflow" module.

    0 讨论(0)
  • 2020-11-28 06:09

    you might wanna try this:

    $conda install -c conda-forge tensorflow
    
    0 讨论(0)
  • 2020-11-28 06:10

    Check if Tensorflow was installed successfully using:

     pip3 show tensorflow
    

    If you get something like

    Name: tensorflow
    Version: 1.2.1
    Summary: TensorFlow helps the tensors flow
    Home-page: http://tensorflow.org/
    Author: Google Inc.
    Author-email: opensource@google.com
    License: Apache 2.0
    Location: /usr/local/lib/python3.5/dist-packages
    Requires: bleach, markdown, html5lib, backports.weakref, werkzeug, numpy, protobuf, wheel, six
    

    You may try adding the path of your tensorflow location by:

    export PYTHONPATH=/your/tensorflow/path:$PYTHONPATH.
    
    0 讨论(0)
提交回复
热议问题