PyCharm 2019.1 has tensorflow but import doesn't work

I've installed tensorflow on PyCharm 2019.1, and it must be there because when I type "from tensorflow import k" I get a "keras" autocomplete option, as I would expect.

But when I try "import tensorflow as tf" and try to run, I get a "ImportError: No module named tensorflow" error.

I can successfully import the package from the console this way, just not in running an actual script. What might be going on here?

Thanks in advance.

 

1 comment
Comment actions Permalink

Hi,

That means that your script is being run from different environment for some reason. Ensure that your run configuration is set to use default project interpreter, the same that python console use.

 

Compare the output of `print(sys.path)` both from your script and python console.

0

Please sign in to leave a comment.