整理了tensorflow完整配置一遍的流程,适用于各个版本的tensorflow安装
版本对应情况
版本 | Python 版本 | 最后版本发布时间 |
---|---|---|
tensorflow-2.4.0 | 3.6-3.8 | 2020年12月 |
tensorflow-2.3.0 | 3.5-3.8 | 2020年7月 |
tensorflow-2.2.0 | 3.5-3.8 | 2020年5月 |
tensorflow-2.1.0 | 3.5-3.7 | 2020年1月 |
tensorflow-2.0.0 | 3.5-3.7 | 2019年10月 |
tensorflow-1.15.0 | 3.5-3.7 | 2019年10月 |
tensorflow-1.14.0 | 3.5-3.7 | 2019年6月 |
tensorflow-1.13.0 | 3.5-3.7 | 2019年2月 |
tensorflow-1.12.0 | 3.5-3.6 | 2018年11月 |
tensorflow-1.11.0 | 3.5-3.6 | 2018年9月 |
tensorflow-1.10.0 | 3.5-3.6 | 2018年8月 |
tensorflow-1.9.0 | 3.5-3.6 | 2018年7月 |
tensorflow-1.8.0 | 3.5-3.6 | 2018年4月 |
tensorflow-1.7.0 | 3.5-3.6 | 2018年3月 |
tensorflow-1.6.0 | 3.5-3.6 | 2018年3月 |
tensorflow-1.5.0 | 3.5-3.6 | 2018年1月 |
tensorflow-1.4.0 | 3.5-3.6 | 2017年11月 |
tensorflow-1.3.0 | 3.5-3.6 | 2017年8月 |
tensorflow-1.2.0 | 3.5-3.6 | 2017年6月 |
tensorflow-1.1.0 | 3.5 | 2017年4月 |
tensorflow-1.0.0 | 3.5 | 2017年2月 |
- 删除旧环境
conda remove -n name --all
- 创建新环境name并指定python版本
conda create --prefix=环境地址 python=目标版本
conda create -n 环境名称python=目标版本
例如
conda create --prefix=E:\Anaconda3\envs\tf1.12 python=3.6
- 安装tensorflow
pip install tensorflow-gpu==1.12 -i https://pypi.tuna.tsinghua.edu.cn/simple
遇到报错:protobuf requires Python '>=3.7' but the running Python is 3.6.13
解决方案:
python -m pip install --upgrade pip
- 安装keras和cuda
tensorflow与keras版本对照表https://www.cnblogs.com/-yhwu/p/14619541.html
pip install keras==2.2.5 -i https://pypi.tuna.tsinghua.edu.cn/simple
对于tensorflow1.12,对应的cuda=9.0,安装指令:
conda install cudatoolkit=9.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64/
遇到报错:CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
解决方案:到anaconda的安装目录位置:比如 D:\ProgramData\Anaconda3\Library\bin,找到如下两个DLL的文件:libcrypto-1_1-x64.dll;libssl-1_1-x64.dll。复制到 D:\ProgramData\Anaconda3\DLLs
查看Cuda对应的cuDNN版本号:
conda search cudnn –info
安装cuDNN=7.2:
conda install cudnn=7.2