欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Anaconda安装+TensorFlow安装+Keras安装+numpy安装(包含镜像和版本信息兼容问题)

程序员文章站 2024-02-28 18:58:52
...

TensorFlow与Keras以及Python版本一一对应表

Framework Env name (--env parameter) Description
TensorFlow 2.2 tensorflow-2.2 TensorFlow 2.2.0 + Keras 2.3.1 on Python 3.7.
TensorFlow 2.1 tensorflow-2.1 TensorFlow 2.1.0 + Keras 2.3.1 on Python 3.6.
TensorFlow 2.0 tensorflow-2.0 TensorFlow 2.0.0 + Keras 2.3.1 on Python 3.6.
TensorFlow 1.15 tensorflow-1.15 TensorFlow 1.15.0 + Keras 2.3.1 on Python 3.6.
TensorFlow 1.14 tensorflow-1.14 TensorFlow 1.14.0 + Keras 2.2.5 on Python 3.6.
TensorFlow 1.13 tensorflow-1.13 TensorFlow 1.13.0 + Keras 2.2.4 on Python 3.6.
TensorFlow 1.12 tensorflow-1.12 TensorFlow 1.12.0 + Keras 2.2.4 on Python 3.6.
  tensorflow-1.12:py2 TensorFlow 1.12.0 + Keras 2.2.4 on Python 2.
TensorFlow 1.11 tensorflow-1.11 TensorFlow 1.11.0 + Keras 2.2.4 on Python 3.6.
  tensorflow-1.11:py2 TensorFlow 1.11.0 + Keras 2.2.4 on Python 2.
TensorFlow 1.10 tensorflow-1.10 TensorFlow 1.10.0 + Keras 2.2.0 on Python 3.6.
  tensorflow-1.10:py2 TensorFlow 1.10.0 + Keras 2.2.0 on Python 2.
TensorFlow 1.9 tensorflow-1.9 TensorFlow 1.9.0 + Keras 2.2.0 on Python 3.6.
  tensorflow-1.9:py2 TensorFlow 1.9.0 + Keras 2.2.0 on Python 2.
TensorFlow 1.8 tensorflow-1.8 TensorFlow 1.8.0 + Keras 2.1.6 on Python 3.6.
  tensorflow-1.8:py2 TensorFlow 1.8.0 + Keras 2.1.6 on Python 2.
TensorFlow 1.7 tensorflow-1.7 TensorFlow 1.7.0 + Keras 2.1.6 on Python 3.6.
  tensorflow-1.7:py2 TensorFlow 1.7.0 + Keras 2.1.6 on Python 2.
TensorFlow 1.5 tensorflow-1.5 TensorFlow 1.5.0 + Keras 2.1.6 on Python 3.6.
  tensorflow-1.5:py2 TensorFlow 1.5.0 + Keras 2.1.6 on Python 2.
TensorFlow 1.4 tensorflow-1.4 TensorFlow 1.4.0 + Keras 2.0.8 on Python 3.6.
  tensorflow-1.4:py2 TensorFlow 1.4.0 + Keras 2.0.8 on Python 2.
TensorFlow 1.3 tensorflow-1.3 TensorFlow 1.3.0 + Keras 2.0.6 on Python 3.6.
  tensorflow-1.3:py2 TensorFlow 1.3.0 + Keras 2.0.6 on Python 2.
TensorFlow 1.2 tensorflow-1.2 TensorFlow 1.2.0 + Keras 2.0.6 on Python 3.5.
  tensorflow-1.2:py2 TensorFlow 1.2.0 + Keras 2.0.6 on Python 2.
TensorFlow 1.1 tensorflow TensorFlow 1.1.0 + Keras 2.0.6 on Python 3.5.
  tensorflow:py2 TensorFlow 1.1.0 + Keras 2.0.6 on Python 2.
TensorFlow 1.0 tensorflow-1.0 TensorFlow 1.0.0 + Keras 2.0.6 on Python 3.5.
  tensorflow-1.0:py2 TensorFlow 1.0.0 + Keras 2.0.6 on Python 2.
TensorFlow 0.12 tensorflow-0.12 TensorFlow 0.12.1 + Keras 1.2.2 on Python 3.5.
  tensorflow-0.12:py2 TensorFlow 0.12.1 + Keras 1.2.2 on Python 2.
PyTorch 1.5 pytorch-1.5 PyTorch 1.5.0 + fastai 1.0.61 on Python 3.7.
PyTorch 1.4 pytorch-1.4 PyTorch 1.4.0 + fastai 1.0.60 on Python 3.6.
PyTorch 1.3 pytorch-1.3 PyTorch 1.3.0 + fastai 1.0.60 on Python 3.6.
PyTorch 1.2 pytorch-1.2 PyTorch 1.2.0 + fastai 1.0.60 on Python 3.6.
PyTorch 1.1 pytorch-1.1 PyTorch 1.1.0 + fastai 1.0.57 on Python 3.6.
PyTorch 1.0 pytorch-1.0 PyTorch 1.0.0 + fastai 1.0.51 on Python 3.6.
  pytorch-1.0:py2 PyTorch 1.0.0 on Python 2.
PyTorch 0.4 pytorch-0.4 PyTorch 0.4.1 on Python 3.6.
  pytorch-0.4:py2 PyTorch 0.4.1 on Python 2.
PyTorch 0.3 pytorch-0.3 PyTorch 0.3.1 on Python 3.6.
  pytorch-0.3:py2 PyTorch 0.3.1 on Python 2.
PyTorch 0.2 pytorch-0.2 PyTorch 0.2.0 on Python 3.5
  pytorch-0.2:py2 PyTorch 0.2.0 on Python 2.
PyTorch 0.1 pytorch-0.1 PyTorch 0.1.12 on Python 3.
  pytorch-0.1:py2 PyTorch 0.1.12 on Python 2.
Theano 0.9 theano-0.9 Theano rel-0.8.2 + Keras 2.0.3 on Python3.5.
  theano-0.9:py2 Theano rel-0.8.2 + Keras 2.0.3 on Python2.
Caffe caffe Caffe rc4 on Python3.5.
  caffe:py2 Caffe rc4 on Python2.
Torch torch Torch 7 with Python 3 env.
  torch:py2 Torch 7 with Python 2 env.
Chainer 1.23 chainer-1.23 Chainer 1.23.0 on Python 3.
  chainer-1.23:py2 Chainer 1.23.0 on Python 2.
Chainer 2.0 chainer-2.0 Chainer 1.23.0 on Python 3.
  chainer-2.0:py2 Chainer 1.23.0 on Python 2.
MxNet 1.0 mxnet MxNet 1.0.0 on Python 3.6.
  mxnet:py2 MxNet 1.0.0 on Python 2.

安装Anaconda

Anaconda各个版本的安装包(官网)(根据对应的Python版本找到需要的Anaconda版本安装包进行下载)

安装Anaconda时所有的框框都✔打勾,直接傻瓜式安装。(注意选择安装地址的时候,地址不要包含中文)

需要添加的镜像:

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2

 

tensorflow和numpy对应的版本

tensorflow numpy cuda cudnn
2.0.0 1.16.4    
1.14.0 1.16.0 10.0 7.6.5
1.13.1 1.16.0    
1.12.0 1.15.4    
1.8.0 1.14.5  

更改numpy版本方法:

pip install -U -i https://pypi.tuna.tsinghua.edu.cn/simple numpy==版本
# -U 是重装
# -i https://pypi.tuna.tsinghua.edu.cn/simple 是使用清华镜像

或者用另外一个镜像(这个镜像的速度更快)

http://pypi.douban.com/simple --trusted-host pypi.douban.com

 1.打开Anaconda Prompt,检查Anaconda是否成功安装:conda --version

 2.检测目前安装了哪些环境:conda info --envs

 4.安装不同版本的python:conda create -n tensorflow python=3.6.5

用到的视频安装教程:Anaconda、Tensorflow、keras安装可能出现的问题及解决/经验分享

教程中用到的命令:Anaconda Prompt

1.(base)环境
python -m pip install -U pip
//正确的结果为:Successfully...
2.(base)环境
//创建名为tensorflow的环境,同时安装python
conda create --name tensorflow python=3.6
3.(base)
activate tensorflow
4.(tensorflow)
pip install tensorflow==1.15.0 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
5.(tensorflow)
//检查tensorflow是否安装成功
python
import tensorflow as tf
//出现安装时间就是安装成功
6.(tensorflow)
pip install keras==2.2.5 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
7.(tensorflow)
//检查keras是否安装成功
python
import keras
//安装成功会显示Using TensofFlow backend

我的Anaconda版本:Anaconda3-5.2.0

Python版本:3.6.1.2

keras版本:2.3.1

numpy版本:1.13.1

tensorflow版本:1.2.1