-3

I tried to code on Pycharm, but when I use from keras import backend as K it throws an import error like "cannot import name backend". But I can do it on terminal.

How can I fix this?

error

on terminal

petezurich
  • 9,280
  • 9
  • 43
  • 57
Akilos
  • 1
  • 1
  • 1
  • 2
    Possible duplicate of [Pycharm cannot find installed packages: keras](https://stackoverflow.com/questions/39620014/pycharm-cannot-find-installed-packages-keras) – Ken Y-N Sep 01 '17 at 01:45

3 Answers3

1

Are you sure your PyCharm sees the same Python environment as what you are using in Terminal?

See if this possibly works for you: use tensorflow on pyCharm

VS_FF
  • 2,353
  • 3
  • 16
  • 34
0

I got the same problem: Check here:Pycharm cannot find installed packages: keras

After adding new package to project interpreter, you need to quit Pycharm and restart it again.

LunaRivolxoxo
  • 330
  • 2
  • 5
0

Use

from tensorflow.python.keras import backend as K

instead.