编译安装caffe工程时报错
编译caffe
环境:cuda11.4,opencv4.5
报错:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)
报错内容参考:https://blog.csdn.net/u014613745/article/details/78310916
发现caffe无法引用opencv中各个函数,推测opencv版本较新,与caffe工程里引用的函数名有改变。
重新安装opencv
进入到之前编译的opencv目录,卸载安装
cd opencv
cd build
sudo make uninstall
重新编译低版本opencv
参考:https://blog.csdn.net/chentianting/article/details/85677166
因cuda版本太高,cmake无法成功,因此选择编译时不使用CUDA,
cmake时增加参数:
-D WITH_NVCUVID=OFF
低版本opencv编译成功。
再次对caffe工程进行编译,并编译pycaffe:
sudo make clean
sudo make -j24
sudo make pycaffe -j24
pycaffe编译成功后将caffe文件下的python文件夹加入环境变量。
sudo gedit ~/.bashrc
添加: export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH
source ~/.bashrc
安装一些python文件夹会用到的依赖,在python/requirments.txt里,随后进入python文件夹,import caffe成功
参考链接
https://blog.csdn.net/chentianting/article/details/85677166
https://blog.csdn.net/u014613745/article/details/78310916
https://blog.csdn.net/yllifesong/article/details/80980338