Can't import tensorflow in PyCharm

白昼怎懂夜的黑 提交于 2021-01-28 09:00:28

问题


I'm trying to import tensorflow in PyCharm, however I get an error that the module is not found. I used pip install to install tensorflow. Also when I look at the interpreter in PyCharm it says I have pip version 9.0.1 and the latest is 10.0.1. I have upgraded to 10.0.1 using the pip commands, and when I run pip --version it says I got 10.0.1. I have tried both reinstalling pycharm and making new projects with no luck.


回答1:


Go to Files -> Settings -> Project:projectname -> Project Interpreter

It's possible, that there is a different interpreter choosen for your project then the one you installed tensorflow in. If you're running on linux you can check with "which pip" the path to your python distro in which you installed tensorflow.




回答2:


This video explain it on a very simple way: https://www.youtube.com/watch?v=K9ypGzuP6xQ

Basically, TensorFlow is not by default installed on PyCharm virtual environment. You can do it by downloading in the Project Interpreter menu




回答3:


try cleaning System Cache

On the main menu, choose File | Invalidate Caches/Restart.

The Invalidate Caches

Cleaning Cache



来源:https://stackoverflow.com/questions/50169945/cant-import-tensorflow-in-pycharm

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