1.安装anaconda(全英文文件夹下)
详细可看https://blog.csdn.net/fan18317517352/article/details/123035625
2.验证:输入下面命令出现版本信息即成功
conda --version
3.在Anaconda Prompt中分别运行如下两条命令:(以下都在该控制台执行/cmd也可以)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
4.创建虚拟环境:
conda create -n test python=3.8
4.1 关于虚拟环境创建失败:
#报错1.因为清华镜像原因可直接执行:
https://blog.csdn.net/qq_38022469/article/details/117668096
#报错2.Package missing in current win-64 channels:
# - python 3.8* 可执行:
conda create -c https://conda.anaconda.org/conda-forge -n test python=3.8
5.启动虚拟环境:(之后的都要在同一个环境里执行)
activate test
6.检查numpy版本:(一定不能大于1.19.2,我用的1.19.2)
#进入python环境,输入如下验证命令:
python
import numpy
numpy.__version__
'''
查看版本信息,输入:ctrl+z回车退出
如果版本过高要卸载numpy安装低版本numpy
卸载:pip uninstall numpy
安装:pip install numpy==1.19.2
再次查看numpy版本信息是否降级
版本过低如果不能直接安装则先pip install numpy
再pip uninstall numpy再pip install numpy==1.19.2
'''
7.安装tensorflow:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
#检查:
conda list
#进入python环境,输入如下验证命令:
#检验代码
python
import tensorflow as tf
#没报错就ok
#输入:ctrl+z回车退出
8.安装keras:
pip install keras
9.安装sklearn:
pip install sklearn
10.执行
jupyter notebook
11.如果10不能正确导入tensorflow,回Anaconda Prompt的test环境下执行:
activate test #启动test环境
conda install ipython #Y/n 选Y
conda install jupyter #Y/n 选Y
12.执行jupyter notebook