python - 无法安装 Caffe 的先决条件 "Boost"

标签 python boost compilation shared-libraries caffe

我正在研究机器学习,最近我发现了这个:Wide-Area Image Geolocalization with Aerial Reference Imagery

这是一个仅根据图像来预测图像的 GPS 位置的网络。不用说,我很兴奋,才发现其中一个要求:

import glob
import caffe
import numpy as np
import multiprocessing
import matplotlib.pyplot as plt
from collections import defaultdict

是 Caffe,我似乎无法安装它,因为我无法安装主要先决条件:Boost

我首先尝试运行标准sudo apt-get install libboost-all-dev,但不仅失败了:

The following packages have unmet dependencies:
 libboost-all-dev : Depends: libboost-chrono-dev but it is not going to be installed
                    Depends: libboost-date-time-dev but it is not going to be installed
                    Depends: libboost-filesystem-dev but it is not going to be installed
                    Depends: libboost-graph-dev but it is not going to be installed
                    Depends: libboost-graph-parallel-dev but it is not going to be installed
                    Depends: libboost-iostreams-dev but it is not going to be installed
                    Depends: libboost-log-dev but it is not going to be installed
                    Depends: libboost-mpi-dev but it is not going to be installed
                    Depends: libboost-mpi-python-dev but it is not going to be installed
                    Depends: libboost-program-options-dev but it is not going to be installed
                    Depends: libboost-python-dev but it is not going to be installed
                    Depends: libboost-regex-dev but it is not going to be installed
                    Depends: libboost-serialization-dev but it is not going to be installed
                    Depends: libboost-system-dev but it is not going to be installed
                    Depends: libboost-thread-dev but it is not going to be installed
                    Depends: libboost-wave-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

它给了我一个“但不会安装”错误。然后我尝试从源安装:

wget -O boost_1_55_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
tar xzvf boost_1_55_0.tar.gz
cd boost_1_55_0/
./bootstrap.sh --prefix=/usr/local
./b2

这很快就让我的整个终端充满了 g++ 错误。然后我尝试从头开始:

sudo apt-get --purge remove libboost-all-dev libboost-dev libboost-doc
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get clean
sudo apt-get update
sudo apt-get install libboost1.54-dev

虽然可以使用测试脚本:How to Install boost on Ubuntu?

当我尝试制作caffe时,我得到了这个:

CXX src/caffe/util/db.cpp
In file included from ./include/caffe/common.hpp:19:0,
                 from ./include/caffe/util/db.hpp:6,
                 from src/caffe/util/db.cpp:1:
./include/caffe/util/device_alternate.hpp:34:23: fatal error: cublas_v2.h: No such file or directory
 #include <cublas_v2.h>
                       ^
compilation terminated.
make: *** [.build_release/src/caffe/util/db.o] Error 1

这可能是什么问题?

最佳答案

好吧,我不认为这是一个 Boost 问题,而是一个 Caffe 问题!

据报道,对于 Caffe 安装,请确保在 makefile.config设置 CPU_Only := 1,如下所示:

# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1

这是因为您的 device_alternate.hpp 具有以下内容:

line  4: #ifdef CPU_ONLY
line 32: #else
line 34: #include <cublas_v2.h>
line 99: #endif

关于python - 无法安装 Caffe 的先决条件 "Boost",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37231325/

相关文章:

c++ - boost 中的属性是如何解析的? SOAP xml 解析?

c++ - boost async_wait() 会导致一个新线程吗?

python - Ubuntu:通过apt安装包后从源重新安装的正确方法是什么?

ios - 是否可以将类型删除应用于协议(protocol)中的返回值?

python - 实时向 matlibplot 散点图添加点

Python:为什么导入的模块不能引用另一个导入的模块?

c++ boost 库 - 写入 ini 文件而不覆盖?

c - 制作 libcurl CodeLite 项目

python - 在 FastAPI 中测试 Pydantic 设置

python - 为 Lambda *编译* Python3 是一个好习惯吗?