https://www.anaconda.com/download/ 官网下载Anaconda后,按照其他博客安装好。 详细安装链接:Anaconda 注意安装过程中一直点下一步, **注意:**选择安装路径,路径所在文件夹必须是空的。 **注意:**此处把两个地方都勾选上,这样环境变量就自动添加到计算机下了。 安装结束后,在开始栏找到Anaconda,打开Anaconda Prompt,进入终端后方便镜像下载。
0.导入镜像包 设置额外的源,直接从速度快的源进行下载。
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/参考链接:https://blog.csdn.net/feifei3211/article/details/80361227 1.创建Python环境
conda create --name tensorflow14 python=3.6代表创建一个python3.6的环境,我们把它命名为tensorflow14
2.激活环境
conda activate tensorflow14激活环境,方便在该环境中安装库
3.安装tensorflow的1.14版本 首先升级pip,防止出现问题
python -m pip install -i https://pypi.doubanio.com/simple/ --upgrade pip python -m pip install -i https://pypi.doubanio.com/simple/ --upgrade setuptools然后镜像安装tensorflow
pip install -i https://pypi.doubanio.com/simple/ tensorflow==1.144.训练测试代码 输入
python进入到python内部,输入以下代码测试tensorflow是否安装成功
import tensorflow as tf sess = tf.Session() a = tf.constant(1) b = tf.constant(2) print(sess.run(a+b))出现以下界面,则安装成功。 5.镜像安装Tensorflow对应Keras2.2.5版本:
pip install -i https://pypi.doubanio.com/simple/ keras==2.2.5其他库的安装也可以使用此行代码,只需更改库名即可。 Tensorflow对应的Keras版本: 6.安装其他库
pip install -i https://pypi.doubanio.com/simple/ opencv-python pip install -i https://pypi.doubanio.com/simple/ pillow pip install -i https://pypi.doubanio.com/simple/ matplotlib7.所有需要的库安装好后,训练模型