简体   繁体   中英

no module named tensorflow.contrib

I have this problem when I import tensorflow.contrib.slim

import tensorflow.contrib.slim as slim

i get this error message

Traceback (most recent call last):
File "/home/toshiba/PFE/DocFace-master/src/tflib.py", line 28, in <module>
import tensorflow.contrib.slim as slim

ModuleNotFoundError: No module named 'tensorflow.contrib'

tensorflow is correctly installed and i found some solutions that said that the file name is tensorflow so it causes the problem but that is not the case in here

I have this problem when I import tensorflow.contrib.slim

import tensorflow.contrib.slim as slim

i get this error message

Traceback (most recent call last):
File "/home/toshiba/PFE/DocFace-master/src/tflib.py", line 28, in <module>
import tensorflow.contrib.slim as slim

ModuleNotFoundError: No module named 'tensorflow.contrib'

tensorflow is correctly installed and i found some solutions that said that the file name is tensorflow so it causes the problem but that is not the case in here

tf.contrib is not supported in TensorFlow 2.x, but you can exploit TensorFlow-Slim avoiding to downgrade TensorFlow.

You have to install TensforFlow-Slim as pip install --upgrade tf_slim and then substitute import tensorflow.contrib.slim as slim in your code with import tf_slim as slim

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM