问题
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