mac安装caffe(避免踩坑的脚本)

来源:互联网 发布:隔壁老王 知乎 编辑:程序博客网 时间:2024/06/03 16:55

本人把要踩得坑都踩完了,比如pycaffe和cv2一起import导致protobuf出现错误啦 ,opencv没被link导致找不到啦,最后终于ok啦

    brew install opencv3 --with-contrib --with-ffmpeg --with-tbb --with-qt5 --with-python    export OpenCV_DIR=/usr/local/Cellar/opencv3/3.1.0_1/share/OpenCV    echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth    brew link opencv3 --force    #高性能矩阵计算,数值运算库    brew install openblas    #不加可能不会在/usr/local/include(bin) 中创建openblas的link,导致查找不到cblas.h的错误    brew link openblas --force    brew install szip    #谷歌开发的混合语言数据标准,序列化    #直接用动态库opencv和caffe链接到同一个动态protocol库会出错    git clone https://github.com/google/protobuf.git    cd protobuf    git clone -b release-1.7.0 https://github.com/google/googlemock.git gmock    cd gmock    git clone -b release-1.7.0 https://github.com/google/googletest.git gtest    cd ../cmake    mkdir build    cd build    cmake -DBUILD_SHARED_LIBS=OFF ..    make -j4    make install    cd ../../python    python setup.py build    python setup.py test    python setuppy install    #brew install --build-from-source --with-python -vd protobuf    #谷歌开发的日志系统    brew install glog    #谷歌开源的处理命令行参数的库    brew install gflags    #层次型的数据存储格式,包含了数据定义和支持接口    brew install hdf5    #caffe需要使用的智能指针等来自boost库,还有python调研c++的借口也由boost实现    brew install --build-from-source -vd boost boost-python    #一些nosql的数据库,caffe的数据存储    brew install lmdb    brew install snappy    brew install leveldb  <pre name="code" class="plain">    git clone https://github.com/BVLC/caffe.git    cd caffe    #安装python caffe    for req in $(cat python/requirements.txt); do pip install $req; done    echo "if import caffe failed with segment fault, check the python lib link, you should link local python lib manully"    mkdir build    cd build    #mac dose not support cuda, use cpu only    cmake -DCPU_ONLY=ON ..    make all    make install    make runtest




0 0
原创粉丝点击