要使用人脸检测项目中的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/serialLIBRARY_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的建立一个软连接到lib
hdf5.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
原文地址:https://www.cnblogs.com/yamin/p/10216589.html
时间: 2024-10-10 06:34:56