K210-yolo3 icon indicating copy to clipboard operation
K210-yolo3 copied to clipboard

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

Open TakuroFukamizu opened this issue 5 years ago • 2 comments

I've run python3 voc_annotation.py ./VOCdevkit but get a following error.

Traceback (most recent call last):
  File "voc_annotation.py", line 2, in <module>
    import tensorflow.python as tf
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/deprecation_wrapper.py", line 106, in __getattr__
    attr = getattr(self._dw_wrapped_module, name)
AttributeError: module 'tensorflow' has no attribute 'python'

After modified line 2 to import tensorflow as tf, It's good for running.

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.

TakuroFukamizu avatar Aug 16 '19 14:08 TakuroFukamizu

My code test in tensorflow r1.14, maybe you should update your tensorflow.

All package:

numpy==1.16.2 tensorflow_gpu==1.14.0 opencv_python==4.0.0.21 matplotlib==3.0.3 Pillow==6.1.0

zhen8838 avatar Aug 16 '19 14:08 zhen8838

chande this line. It work for my.

#import tensorflow.python as tf import tensorflow as tf

#mport tensorflow.python.keras.backend as K import tensorflow.keras.backend as K

ar055 avatar Dec 14 '19 10:12 ar055