ImportError: cannot import name 'dnn_logit_fn_builder' from partially initialized module 'tensorflow_estimator.python.estimator.canned.dnn'
ImportError: cannot import name 'dnn_logit_fn_builder' from partially initialized module 'tensorflow_estimator.python.estimator.canned.dnn'
在 conda env
中使用 jupyter notebook
导致我在导入时出现该错误 tensorflow_hub
:
ImportError: cannot import name 'dnn_logit_fn_builder' from partially initialized module
'tensorflow_estimator.python.estimator.canned.dnn' (most likely due to a circular import)
(C:\Users\Anaconda3\envs\my_env\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py)
我的环境是安装 pandas、tensorflow-hub、numpy、tensorflow 和 python=3.8.5.
创建的
更多详情:
tensorflow 2.3.0
tensorflow-base 2.3.0
tensorflow-estimator 2.3.0 conda-forge
tensorflow-hub 0.12.0 conda-forge
为什么会出现此错误?
与 Tensorflow 2.6.0 一起工作,api 名称几乎没有变化,如 tf.compat.v1.estimator.experimental.dnn_logit_fn_builder
import tensorflow as tf
tf.compat.v1.estimator.experimental.dnn_logit_fn_builder
我的(Windows10,Python3.8,自己的shell)我也遇到了这个问题。然后,单独导入有问题的行解决了问题。也就是说,我写了
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
然后我导入了
import tensorflow_hub as hub
一切都很好。
在 conda env
中使用 jupyter notebook
导致我在导入时出现该错误 tensorflow_hub
:
ImportError: cannot import name 'dnn_logit_fn_builder' from partially initialized module
'tensorflow_estimator.python.estimator.canned.dnn' (most likely due to a circular import)
(C:\Users\Anaconda3\envs\my_env\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py)
我的环境是安装 pandas、tensorflow-hub、numpy、tensorflow 和 python=3.8.5.
创建的更多详情:
tensorflow 2.3.0
tensorflow-base 2.3.0
tensorflow-estimator 2.3.0 conda-forge
tensorflow-hub 0.12.0 conda-forge
为什么会出现此错误?
与 Tensorflow 2.6.0 一起工作,api 名称几乎没有变化,如 tf.compat.v1.estimator.experimental.dnn_logit_fn_builder
import tensorflow as tf
tf.compat.v1.estimator.experimental.dnn_logit_fn_builder
我的(Windows10,Python3.8,自己的shell)我也遇到了这个问题。然后,单独导入有问题的行解决了问题。也就是说,我写了
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
然后我导入了
import tensorflow_hub as hub
一切都很好。