美文网首页
caffe2 ubuntu16.04 安装方法

caffe2 ubuntu16.04 安装方法

作者: RobertY | 来源:发表于2017-11-04 10:07 被阅读2455次

    Caffe2的安装相比于caffe在安装的时候更加简便,略去了Makefile.config的各种配置,对于有无GPU以及各种可选库例如opencv,anaconda的支持也更简单。(其实你直接装好库以后make就好,以GPU为例,在make的时候,自动检测你是否安装了CUDA,若没有,就自动CPU only)

    在开始安装之前,附上caffe2的官方链接,官网对于安装还是讲的非常详细易懂:https://caffe2.ai/docs/getting-started.html?platform=ubuntu&configuration=compile

    依赖库的安装

    Required Dependencies

    sudo apt-get update
    sudo apt-get install -y --no-install-recommends \
      build-essential \
      cmake \
      git \
      libgoogle-glog-dev \
      libprotobuf-dev \
      protobuf-compiler \
      python-dev \
      python-pip                          
    sudo pip install numpy protobuf
    

    Optional GPU Support

    自动检测是否安装了CUDA,若没有,就自动CPU only

    For Ubuntu 14.04

    sudo apt-get update && sudo apt-get install wget -y --no-install-recommends
    wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_8.0.61-1_amd64.deb"
    sudo dpkg -i cuda-repo-ubuntu1404_8.0.61-1_amd64.deb
    sudo apt-get update
    sudo apt-get install cuda
    

    For Ubuntu 16.04

    sudo apt-get update && sudo apt-get install wget -y --no-install-recommends
    wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb"
    sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
    sudo apt-get update
    sudo apt-get install cuda
    

    Optional Dependencies

    for Ubuntu 14.04

    sudo apt-get install -y --no-install-recommends libgflags2
    

    for Ubuntu 16.04

    sudo apt-get install -y --no-install-recommends libgflags-dev
    

    for both Ubuntu 14.04 and 16.04

    sudo apt-get install -y --no-install-recommends \
      libgtest-dev \
      libiomp-dev \
      libleveldb-dev \
      liblmdb-dev \
      libopencv-dev \
      libopenmpi-dev \
      libsnappy-dev \
      openmpi-bin \
      openmpi-doc \
      python-pydot
    
    sudo -H pip install --upgrade pip
    ##这里更新一下pip,否则后面pip安装jupyter有可能会报错
    
    sudo pip install \
      flask \
      future \
      graphviz \
      hypothesis \
      jupyter \
      matplotlib \
      pydot python-nvd3 \
      pyyaml \
      requests \
      scikit-image \
      scipy \
      setuptools \
      six \
      tornado
    

    克隆和安装

    git clone --recursive https://github.com/caffe2/caffe2.git && cd caffe2
    make && cd build && sudo make install
    python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
    

    环境变量设置

    vim $PYTHONPATH
    # export PYTHONPATH=/usr/local:$PYTHONPATH
    # export PYTHONPATH=$PYTHONPATH:/home/pengyu/caffe2/build
    echo $LD_LIBRARY_PATH
    # export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    

    参考文献

    caffe2 官方安装教程:https://caffe2.ai/docs/getting-started.html?platform=ubuntu&configuration=compile

    博客:ubuntu16.04安装caffe2(CPU only) http://blog.csdn.net/Andy965/article/details/70808909?locationNum=5&fps=1

    相关文章

      网友评论

          本文标题:caffe2 ubuntu16.04 安装方法

          本文链接:https://www.haomeiwen.com/subject/inrfmxtx.html