Python安装keras和tensorflow-cpu

首先,将以前安装失败的虚拟环境删除

conda env remove -n tensorflow

随后,新建一个虚拟环境等等

conda create -n tensorflow-cpu python=3.6 
conda activate tensorflow-cpu
pip install tensorflow==1.14.0
#推荐使用pip安装keras:
pip install keras==2.2.5 -i https://pypi.tuna.tsinghua.edu.cn/simple/ 

#安装spyder和jupyter环境
conda install spyder #输入spyder直接进入环境
#安装jupyter环境
conda install ipykernel
pip install pypiwin32
pip install jupyter#conda install jupyer
python -m ipykernel install --user --name tensorflow-cpu --display-name "Python (tensorflow-cpu)"

测试是否成功

# Python
import tensorflow as tf
hello = tf.constant(\'Hello, TensorFlow!\')
sess = tf.Session()
print(sess.run(hello))

安装其他相关库

pip install opencv-python  #import cv2

  

https://www.cnblogs.com/phoenixash/p/12236949.html (版本信息参考)

https://mirror.tuna.tsinghua.edu.cn/help/anaconda/ 镜像修改