Tensorflow cannot be used properly in Pycharm after installation

problem description

Pip can be used normally in jupyterNotebook after Tensorflow is installed normally, but when importing from normal command line and pycharm, it is found that the imported package is not a normal package (you can import the package normally, but as shown in the following figure, this is not the normal introduction of a package, only a .py file is introduced)
ps: installation process does not report an error, no exception

the platform version of the problem and what methods you have tried

because I installed Anaconda3, and created a new special env to install separately, it is still a separate problem. During this period, I have also tried a lot of methods, such as modifying python version 3.5, etc.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

import tensorflow as tf
tf.set_random_seed (1)

clipboard.png

what result do you expect? What is the error message actually seen?

AttributeError: module "tensorflow" has no attribute" set_random_seed"

not only this method, but all methods will show module "tensorflow" has no attribute
I would like to ask if you have encountered this kind of problem and how to solve it.
Thank you.


after more than a day of careful investigation and a large number of articles by Google, it is found that the situation is as follows

install without pip3
install without administrator permission
there is a problem with the installed Tensorflow

then I uninstalled Tensorflow, and deleted the folder under site-package, and then reinstalled it with administrator privileges.
reported some exceptions this time, but it didn't seem to matter, and import Tensorflow,ok ran perfectly in Pycharm again.
but I found that there seems to be a problem with automatic completion. After checking it carefully, I don't know when a more Tensorflow.py, is deleted under the root directory of the project, but the speed of automatic completion is very slow, but I dare not force it, and it is best not to make mistakes.

Menu