安装Anaconda 4.2 + OpenCV3.1
1.下载并安装Anaconda4.2.0
所有的Anaconda版本,Linux选Anaconda3-4.2.0-Linux-x86_64.sh
Windows选Anaconda3-4.2.0-Windows-x86_64.exe
注意系统是64位,Tensorflow只支持windows64位。
(https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/)
2.打开cmd,然后执行(这个网站可能地址不稳定,多试几次)
conda install -c https://conda.anaconda.org/menpo opencv3
3.打开Spyder测试一下代码.
import cv2
print(cv2.__version__)
安装cpu/GPU版TensorFlow
1.安装Anaconda4.2版()
2.新建conda环境:使用管理员权限打开cmd,执行命令conda create -n tensorflow
3.激活conda环境:执行命令activate tensorflow(ubuntu为Source activate tensorflow)
4.在tensorflow环境下,使用pip安装cpu版TensorFlow,执行命令
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-linux_x86_64.whl
测试TensorFlow
1.使用管理员权限打开cmd
2.激活conda环境,执行activate tensorflow
3.打开python,执行python
4.执行以下代码
import tensorflow as tf
hello = tf.constant('Hello,TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
再次使用的时候再激活 :-)
$ source activate tensorflow
(tensorflow)$ # Your prompt should change.
# Run Python programs that use TensorFlow.
...
# When you are done using TensorFlow,deactivate the environment.
(tensorflow)$ source deactivate