环境:PyCharm
问题:ImportError: No module named tensorflow
![解决PyCharm[import tensorflow as tf]报错](http://www.linuxdiyf.com/linux/uploads/allimg/170419/2-1F419233340293.png)
出现问题的原因:之前我们成功安装了TensorFlow1.0版本.所用到的Python解释器和我们当前PyCharm所用的python解释器不一致说导致.故解决方案,将PyCharm的解释器更改为TensorFlow下的python解释器(我这里解释不规范,若您有合适的解释,请及时告诉我.谢谢)
1.找到TensorFlow下的python解释器
source activate tensorflow
which python
![解决PyCharm[import tensorflow as tf]报错](http://www.linuxdiyf.com/linux/uploads/allimg/170419/2-1F419233350P6.png)
2.打开PyCharm软件, 进入File->Settings目录下(默认快捷键CTRL + ALT + S, 貌似不灵)后界面如下:
![解决PyCharm[import tensorflow as tf]报错](http://www.linuxdiyf.com/linux/uploads/allimg/170419/2-1F41923335Y52.png)
当前的python解释器的位置如下:
![解决PyCharm[import tensorflow as tf]报错](http://www.linuxdiyf.com/linux/uploads/allimg/170419/2-1F41923340c41.png)
3.右边有个”设置”按钮,单击后,我们选中”Add Local”,Add Local的路径就是第1步中的结果,具体如下图所示:
![解决PyCharm[import tensorflow as tf]报错](http://www.linuxdiyf.com/linux/uploads/allimg/170419/2-1F419233421c8.png)
4.重新运行,BUG消除.