ModuleNotFoundError: no module named "tensorflow.python.training"

When I try to run this

import keras 

I get the following error :

 Traceback (most recent call last): File "<ipython-input-1-c74e2bd4ca71>", line 1, in <module> import keras File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module> from . import utils File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/utils/__init__.py", line 6, in <module> from . import conv_utils File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/utils/conv_utils.py", line 3, in <module> from .. import backend as K File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/backend/__init__.py", line 83, in <module> from .tensorflow_backend import * File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2, in <module> from tensorflow.python.training import moving_averages ModuleNotFoundError: No module named 'tensorflow.python.training' 

I have already installed Theano , Tensorflow and Keras with the following commands:

Theano:

 Rezwans-iMac:~ rezwan$ pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git 

Tensorflow:

 Rezwans-iMac:~ rezwan$ conda create -n tensorflow python=3.6 

 Rezwans-iMac:~ rezwan$ source activate tensorflow 

 (tensorflow) Rezwans-iMac:~ rezwan$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.3.0rc2-py3-none-any.whl 

 (tensorflow) Rezwans-iMac:~ rezwan$ pip3 install --upgrade $TF_BINARY_URL 

Keras:

 Rezwans-iMac:~ rezwan$ pip install --upgrade keras 

The teams work correctly.

But I am getting higher than error. How can I solve this error?

+5
source share

Source: https://habr.com/ru/post/1272147/


All Articles