因本人电脑不支持GPU版本,只配置了CPU版本
1.首先安装anaconda
本人使用的是2021.11的版本,到清华镜像源网站下载 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
2.创建虚拟环境
在开始菜单中找到Anaconda Prompt,点击打开
在base环境中创建虚拟环境,即在命令行输入以下代码
conda create -n dl python=3.9
3.进入创建好的虚拟环境
在命令行输入conda activate 环境名
conda activate dl
4.在虚拟环境中安装tensorflow及keras
吴恩达老师的课程使用的tensorflow版本为2.6.0、keras版本为2.6.0
注意tensorflow和keras的版本一定要匹配,否则会出现问题
安装tensorflow2.6.0:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow==2.6.0
安装keras2.6.0:
pip install keras==2.6.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
5.安装jupyter notebook
注意这里用conda而不是pip
conda install jupyter
至此环境配置完成,在虚拟环境下在命令行输入jupyter notebook进入web即可
6.安装其他库
安装matplotlib3.3.4:
pip install matplotlib==3.3.4 -i https://pypi.tuna.tsinghua.edu.cn/simple
安装scipy1.5.4:
pip install scipy==1.5.4 -i https://pypi.tuna.tsinghua.edu.cn/simple
安装sklearn0.24.2:
pip install scikit-learn==0.24.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
安装ipympl0.8.8
pip install ipympl==0.8.8
此处出现了这个警告,本人认为可暂时忽略,因为typing-extensions暂时用不上,若降低版本反而可能会出现问题
7.一些问题
1.运行C2_W2_Relu第一块代码时发现
这个是提示我们protobuf包版本太高,应降低版本
pip install protobuf==3.19.6
2.接着运行C2_W2_Rule第二块代码时又发现
这个其实是jupyterlab版本问题,只需要更新一下版本即可解决(关闭web,重启Anaconda Prompt)
conda install jupyterlab
输入这行命令之后会出现这个界面,更新jupyterlab完成之后再打开web即可正常显示交互
其实需要更新的是这三个包,也可以使用conda install命令直接更新这三个包