Finally, I installed the tensorflow2.0 version without downloading keras specifically. Because tensorflow has included keras, in this case, you can refer to keras like this: from tensorflow import keras When referring to functions in keras: from tensorflow.keras import Sequential; Press from folder. Subfolder import function / This form of class name.
My installation process is as follows
conda install --index-url https://pypi.douban.com/simple tensorflow=2.0
conda install mingw libpython
conda install keras
Check the version of keras
python
from tensorflow import keras
print(keras.__version__)
The output is as follows:
Before installing, be sure to find out the suitable version of python, tensorflow, and keras. You must specify the version number for installing.
Python \ keras \ tensorflow version comparison
Mirror of tensorflow:
pip install --index-url https://pypi.douban.com/simple tensorflow
或pip install --index-url http://mirrors.aliyun.com/pypi/simple/ tensorflow
Installation process (this is other tutorial)
Load TensorFlow environment
Open anaconda prompt
更新setuptool:pip install --upgrade -I setuptools
Input: conda create -n tensorflow python = 3.5 and press Enter
Activate the environment: activate tensorflow and press Enter (the close command when not in use is: deactivate)
安装TensorFlow: CPU: pip install --ignore-installed --upgrade tensorflow 或者:pip install tensorflow
Install Keras:
Open anaconda prompt
Type conda install mingw libpython and press Enter
Enter conda install theano and enter y
Enter conda install keras and then enter y
Possible problems
Anaconda3 replaces the domestic mirror (change source)
Anaconda uses conda to connect to the network and there is an error (CondaHTTPError: HTTP 000 CONNECTION FAILED for url) I used the first method to solve it, change https to http