ImportError: No module named 'tensorflow.python'

梦想的初衷 提交于 2019-12-03 06:30:43
zhaozheng

Uninstall tensorflow:

pip uninstall tensorflow

Then reinstall it:

pip install tensorflow

Open a python shell and type:

help('modules')   

This will gather a list of all available modules. tensor flow should not show up, as it is not installed correctly (according to the traceback).
Then:

import sys
sys.path()

This will give you a list of system paths where modules can be installed. If there is a known issue with installing a module, I recommend moving the files manually to the right system path.
The system path depends on the OS you are using, so without knowing that I can't tell you where to move it.
But sys.path() can!

Hope I could help, Narusan

try to change the actual running python directory. and make sure that running python directory is not where you downloaded tensorflow. else go to any other directory and you're fine. i hope that solves your probleme.

I have the same problem in Windows 10. Until now I don't know why.

But if I create an virtual environment

cd <your project path>

Install virtualenv

pip install virtualenv

Create the virtual environment

virtualenv <envname>

Activate the env

  • Windows Powershell: .\<envname>\Scripts\activate
  • Unix with Bash or zsh: source <envname>/bin/activate

Then now you install tensorflow

(<envname>) $ pip install tensorflow

And then run Hello World successfully.

*Don't forget that you need to activate or configure everytime the virtual environment jupyter, command-line, etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!