No module named 'tensorflow.contrib' while importing tflearn

折月煮酒 提交于 2021-01-28 01:18:12

问题


While I was importing tflearn I'm getting this error:-

import tflearn

Traceback (most recent call last): File "", line 1, in File "/Users/rohansethi/anaconda3/lib/python3.7/site-packages/tflearn/init.py", line 4, in from . import config File "/Users/rohansethi/anaconda3/lib/python3.7/site-packages/tflearn/config.py", line 5, in from .variables import variable File "/Users/rohansethi/anaconda3/lib/python3.7/site-packages/tflearn/variables.py", line 7, in from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope ModuleNotFoundError: No module named 'tensorflow.contrib'


回答1:


You need to use an older version of TensorFlow.

tensorflow.contrib

Was removed from tensorflow with versions >=1.14.

This is what you can do:

pip uninstall tensorflow
pip install tensorflow==1.14

To check if everything is working fine: Start python in the console by typing python Then:

import tensorflow
tensorflow.__version__

It should show you 1.14. Now you can run your program.



来源:https://stackoverflow.com/questions/58347171/no-module-named-tensorflow-contrib-while-importing-tflearn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!