Hi,大家好,我是半亩花海。要让一个基于CPU的 tensorflow和keras开发的深度学习模型正确运行起来,配置环境是个重要的问题,本文介绍了tensorflow和keras和对应的python版本以及安装环境的部分流程。目录一、tensorflow+ keras +python版本对照二、tensorflow和keras安装流程一、tensorflow+ keras +python版本对照详情看 tensorflow官网链接如下:BuildfromsourceonWindows | TensorFlow(google.cn)FrameworkPythonversionDescriptionTensorFlow2.93.7.-3.10.TensorFlow2.9.0+KerasTensorFlow2.83.7.-3.10.TensorFlow2.8.0+KerasTensorFlow2.73.7.-3.9.TensorFlow2.7.0+KerasTensorFlow2.63.6.-3.9.TensorFlow2.6.0+Keras2.6.0TensorFlow2.53.6.-3.9.TensorFlow2.5.0+Keras2.5TensorFlow2.43.6.-3.8.TensorFlow2.4.0+Keras2.4.3TensorFlow2.33.5.-3.8.TensorFlow2.3.0+Keras2.4.3TensorFlow2.23.7.TensorFlow2.2.0+Keras2.3.1TensorFlow2.13.6.TensorFlow2.1.0+Keras2.3.1TensorFlow2.03.6.TensorFlow2.0.0+Keras2.3.1TensorFlow1.153.6.TensorFlow1.15.0+Keras2.3.1TensorFlow1.143.6.TensorFlow1.14.0+Keras2.2.5TensorFlow1.133.6.TensorFlow1.13.0+Keras2.2.4TensorFlow1.123.6.TensorFlow1.12.0+Keras2.2.42.TensorFlow1.12.0+Keras2.2.4TensorFlow1.113.6.TensorFlow1.11.0+Keras2.2.42.TensorFlow1.11.0+Keras2.2.4TensorFlow1.103.6.TensorFlow1.10.0+Keras2.2.02.TensorFlow1.10.0+Keras2.2.0TensorFlow1.93.6.TensorFlow1.9.0+Keras2.2.02.TensorFlow1.9.0+Keras2.2.0TensorFlow1.83.6.TensorFlow1.8.0+Keras2.1.62.TensorFlow1.8.0+Keras2.1.6TensorFlow1.73.6.TensorFlow1.7.0+Keras2.1.62.TensorFlow1.7.0+Keras2.1.6TensorFlow1.53.6.TensorFlow1.5.0+Keras2.1.62.TensorFlow1.5.0+Keras2.0.8TensorFlow1.43.6.TensorFlow1.4.0+Keras2.0.82.TensorFlow1.4.0+Keras2.0.8TensorFlow1.33.6.TensorFlow1.3.0+Keras2.0.62.TensorFlow1.3.0+Keras2.0.6二、tensorflow和keras安装流程这里安装python=3.8,tensorflow=2.4.0,keras=2.4.3(segnet是我做的语义分割项目的虚拟环境),若需要将创建的虚拟环境添加到jupyterlab/notebook中使用,则需要第3-6步,否则不用:#1.Anaconda创建虚拟环境condacreate-nsegnetpython=3.8#2.激活并进入虚拟环境activatesegnet#3.安装ipykernelpipinstallipykernel-ihttps://pypi.tuna.tsinghua.edu.cn/simple/#4.安装ipykernel,将虚拟环境加入jupyter 内核中python-mipykernelinstall--namesegnet--display-namesegnet#5.检查新虚拟环境是否成功加入内核jupyterkernelspeclist#6.从指定文件夹里进入jupyterjupyterlab#7.安装tensorflow、keras等软件包pipinstalltensorflow==2.4.0-ihttps://pypi.tuna.tsinghua.edu.cn/simplepipinstallkeras==2.4.3-ihttps://pypi.tuna.tsinghua.edu.cn/simple------------------------------------------------------------------------pipinstallmatplotlib==3.4.3-ihttps://pypi.tuna.tsinghua.edu.cn/simplepipinstallnumpy==1.19.2-ihttps://pypi.tuna.tsinghua.edu.cn/simplepipinstallpillow==10.2.0-ihttps://pypi.tuna.tsinghua.edu.cn/simplepipinstallscipy==1.7.3-ihttps://pypi.tuna.tsinghua.edu.cn/simple