从源代码构建咖啡机时遇到问题

Trouble building caffe from source

我正在尝试通过从 source

构建它来安装 caffe

从 caffe 根目录发出以下命令后

$ make all -j4

我收到一个错误

...
CXX src/caffe/layer_factory.cpp
CXX src/caffe/blob.cpp
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpython3.6
collect2: error: ld returned 1 exit status
Makefile:582: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1

已安装依赖项

$ sudo apt install python3-opencv
$ sudo apt-get install libatlas-base-dev
$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
$ sudo apt-get install --no-install-recommends libboost-all-dev
$ sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
$ sudo apt-get install the python3-dev

CUDA: CUDA 9 CuDnn 7.4

Ubuntu: Ubuntu 18.04

Makefile.config

我查看了源 Github 存储库中的所有 issues,但找不到任何有用的东西。

因此,您的错误指出 cannot find -lpython3.6 您的系统缺少 libpython3.6.so

尝试:
sudo apt-get install libpython3.6-dev

问题已解决,我必须在 Makefile.config 文件

中进行以下更改

来自

PYTHON_LIBRARIES := boost_python3 python3.6
PYTHON_INCLUDE := /usr/include/python3.6 \
/usr/lib/python3.6/dist-packages/numpy/core/include

PYTHON_LIBRARIES := boost_python3 python3.6m
PYTHON_INCLUDE := /usr/include/python3.6m \
/usr/lib/python3.6/dist-packages/numpy/core/include