码迷,mamicode.com
首页 > 其他好文 > 详细

anaconda3安装caffe

时间:2019-01-03 20:44:05      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:some   cat   环境   python   需要   serial   location   人脸检测   hat   

要使用人脸检测项目中的caffe,因为该项目需要重新编译安装caffe,所以需要搭建一个新的环境,对于Python3.5版本

参考:https://blog.csdn.net/qq_33039859/article/details/80377356

首先创建先的环境

conda create -n caffe python=3.5
激活环境
source activate caffe
cp Makefile.config.example Makefile.config

因为是用anaconda安装所以要修改makefile.config


  USE_INDEX_64 := 1

OPENCV_VERSION := 3
#PYTHON_INCLUDE := /usr/include/python2.7 \
#/usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it‘s in root.
ANACONDA_HOME := $(HOME)/anaconda3/envs/caffe
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
$(ANACONDA_HOME)/include/python3.5m \
$(ANACONDA_HOME)/lib/python3.5/site-packages/numpy/core/include
# Uncomment to use Python 3 (default is Python 2)
PYTHON_LIBRARIES := boost_python3 python3.5m
PYTHON_INCLUDE := /usr/include/python3.5m \
/usr/lib/python3.5/dist-packages/numpy/core/include
# We need to be able to find libpythonX.X.so or .dylib.
# PYTHON_LIB := /usr/lib
PYTHON_LIB := $(ANACONDA_HOME)/lib
WITH_PYTHON_LAYER := 1

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu

因为把路径换成了anaconda里面的Python路径,所以要在编译前敲如下命令
export CPLUS_INCLUDE_PATH=/home/amazing/anaconda3/envs/py27/include/python2.7


# Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired)
make all
make test
make runtest

遇上了几个坑,usr/bin/ld:找不到Lxxx:解决办法:https://blog.csdn.net/bangdingshouji/article/details/52876051
其中hdf5要到/usr/lib/x86_64-linux-gnu/中找,把libhdf5_serial.so的建立一个软连接到libhdf5.so
找不到libcudnn.so.5:https://blog.csdn.net/weixin_43439673/article/details/84198228

安装python依赖项
for req in $(cat requirements.txt); do pip install $req; done
最后make pycaffe







anaconda3安装caffe

标签:some   cat   环境   python   需要   serial   location   人脸检测   hat   

原文地址:https://www.cnblogs.com/yamin/p/10216589.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!