机器学习(1)——环境安装

先尝试尝试tensorflow

1. 修改/etc/hosts/ 加入如下行

#TensorFlow start 
64.233.188.121 www.tensorflow.org 

#TensorFlow end

2. 进入官网后有这些选项

  • Pip install: Install TensorFlow on your machine, possibly upgrading previously installed Python packages. May impact existing Python programs on your machine.
  • Virtualenv install: Install TensorFlow in its own directory, not impacting any existing Python programs on your machine.
  • Anaconda install: Install TensorFlow in its own environment for those running the Anaconda Python distribution. Does not impact existing Python programs on your machine.
  • Docker install: Run TensorFlow in a Docker container isolated from all other programs on your machine.
  • Installing from sources: Install TensorFlow by building a pip wheel that you then install using pip.


  选择Anaconda install

3. Anaconda 安装

进入清华镜像 https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

进入下载页面 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

选择下载 Anaconda2-5.1.0-Linux-x86_64.sh

在控制台上进入下载后的文件目录, 默认~/Downloads/ 之下

执行 chmod +x Anaconda2-5.1.0-Linux-x86_64.sh  

执行 

./Anaconda2-5.1.0-Linux-x86_64.sh 

加入conda源

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 --set show_channel_urls yes

3. 安装tensorflow

创建tensorflow虚拟环境

conda create -n tensorflow python=2.7

因为要使用GPU,使用PIP进行安装

$ source activate tensorflow
(tensorflow)$  # Your prompt should change

设定Binary安装路径

# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0rc1-cp27-none-linux_x86_64.whl


安装 test flow

# Python 2
(tensorflow)$ pip install --ignore-installed --upgrade $TF_BINARY_URL


3. 激活GPU Support

1. 安装GTX 1060的驱动

sudo apt-get install nvidia-current-updates 
sudo nvidia-xconfig
sudo reboot


你可能感兴趣的:(机器学习(1)——环境安装)