AttributeError: module 'tensorflow' has no attribute 'python'

后端 未结 2 568
忘了有多久
忘了有多久 2020-12-11 15:11
>import tensorflow

>import tensorflow.contrib

>tensorflow.contrib

module \'tensorflow.contrib\' from \'D:\\\\ProgramData\\\\Anaconda3\\\\lib\\\\site-pack         


        
2条回答
  •  感情败类
    2020-12-11 15:43

    tensorflow.__init__() explicitly deletes its reference to the tensorflow.python module after importing everything from it.

    The reason for that is to provide access to the submodules contained in the python package in the top-level tensorflow namespace. A few things from the tensorflow.core package are also imported and made available in the tensorflow namespace.

    I think that the idea is not to import tensorflow.python directly. Those classes, objects, and submodules of python that are intended to be used by applications are made available simply by import tensorflow.

提交回复
热议问题