问题
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