美文网首页
ubuntu 14.04上安装Caffe

ubuntu 14.04上安装Caffe

作者: crazyhank | 来源:发表于2018-09-09 10:15 被阅读0次
    1. 从github上下载代码
    #git clone https://github.com/BVLC/caffe.git
    
    1. 如果使用python进行开发,需要安装依赖的库
    #cat python/requirements.txt | xargs -L 1 sudo pip install
    
    1. 准备Makefile
    #cp Makefile.config.example Makefile.config
    
    1. 修改Makefile
      (1)我这里只编译CPU版本,将Makefile.config文件中的“CPU_ONLY := 1”一行注释符号去掉。
      (2)因为之前安装python依赖库的时候路径有点出入,修改
      PYTHON_INCLUDE := /usr/include/python2.7 \ /usr/lib/python2.7/dist-packages/numpy/core/include 变成
      PYTHON_INCLUDE := /usr/include/python2.7 \ /usr/local/lib/python2.7/dist-packages/numpy/core/include
      (3)要在Makefile文件中,针对编译器选项上显式的加上C++11支持,如下:
      # Automatic dependency generation (nvcc is handled separately)
      CXXFLAGS += -MMD -MP -std=c++11
      LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
    1. 编译
    #make pycaffe
    #make all
    
    1. 测试
      测试之前需要将caffe的python模块路径加入到PYTHON_PATH中去:
    #echo "PYTHONPATH=/home/hank/Study/CV/caffe.git/python" >> ~/.bashrc
    #source ~/.bashrc
    

    然后执行一下:

    hank@hank-desktop:~/Study/CV/caffe.git$ python
    Python 2.7.6 (default, Nov 23 2017, 15:49:48) 
    [GCC 4.8.4] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import caffe
    >>> print caffe.__version__
    1.0.0
    >>> 
    

    安装完成!

    相关文章

      网友评论

          本文标题:ubuntu 14.04上安装Caffe

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