Tensorflow import error: No module named 'tensorflow'

后端 未结 9 1642
走了就别回头了
走了就别回头了 2020-12-24 14:47

I installed TensorFlow on my Windows Python 3.5 Anaconda environment The validation was successful (with a warning)

(tensorflow) C:\\>python
相关标签:
9条回答
  • 2020-12-24 15:21

    The reason Python 3.5 environment is unable to import Tensorflow is that Anaconda does not store the tensorflow package in the same environment.

    One solution is to create a new separate environment in Anaconda dedicated to TensorFlow with its own Spyder

    conda create -n newenvt anaconda python=3.5
    activate newenvt
    

    and then install tensorflow into newenvt

    I found this primer helpful

    0 讨论(0)
  • 2020-12-24 15:22

    Since none of the above solve my issue, I will post my solution

    WARNING: if you just installed TensorFlow using conda, you have to restart your command prompt!

    Solution: restart terminal ENTIRELY and restart conda environment

    0 讨论(0)
  • 2020-12-24 15:24

    deleting tensorflow from cDrive/users/envs/tensorflow and after that

    conda create -n tensorflow python=3.6
     activate tensorflow
     pip install --ignore-installed --upgrade tensorflow
    

    now its working for newer versions of python thank you

    0 讨论(0)
  • 2020-12-24 15:30

    In Windows 64, if you did this sequence correctly:

    Anaconda prompt:

    conda create -n tensorflow python=3.5
    activate tensorflow
    pip install --ignore-installed --upgrade tensorflow
    

    Be sure you still are in tensorflow environment. The best way to make Spyder recognize your tensorflow environment is to do this:

    conda install spyder
    

    This will install a new instance of Spyder inside Tensorflow environment. Then you must install scipy, matplotlib, pandas, sklearn and other libraries. Also works for OpenCV.

    Always prefer to install these libraries with "conda install" instead of "pip".

    0 讨论(0)
  • 2020-12-24 15:30

    I think your tensorflow is not installed for local environment.The best way of installing tensorflow is to create virtualenv as describe in the tensorflow installation guide Tensorflow Installation .After installing you can activate the invironment and can run anypython script under that environment.

    0 讨论(0)
  • 2020-12-24 15:30

    Visual Studio in left panel is Python "interactive Select karnel"

    Pyton 3.7.x anaconda3/python.exe ('base':conda) I'm this fixing

    0 讨论(0)
提交回复
热议问题