anaconda2 + caffe +gpu centos7

1:anaconda 包管理工具下載地址,找到想要下載的對應版本 copy 下載路徑

2.linux 下下載安裝,點擊下一步下一步,會提示你是不是把路徑放在環(huán)境變量里,回復yes放進去,回車

?wget?https://repo.anaconda.com/archive/Anaconda2-5.1.0-Linux-x86_64.sh

?bash ??Anaconda2-5.1.0-Linux-x86_64.sh

安裝過程中會需要不斷回車來閱讀并同意license。安裝路徑默認為用戶目錄(可以自己指定),最后需要確認將路徑加入用戶的.bashrc中。

最后,立即使路徑生效,需要在用戶目錄下執(zhí)行:

source .basic

3.測試是否安裝,成功進入python界面看出來python版本則成功。

4.anaconda 包的使用

conda ?info ?--package 查看包的版本

conda ?list ?查看已有的包

conda ?install??--package 安裝包

conda ?install ?package=1.2.0 安裝對應的版本包

conda ? uninstall ?--package 卸載包


python 導入 caffe

1.修改caffe 路徑下的Makefile.config 包,注意標黑字體

## Refer to http://caffe.berkeleyvision.org/installation.html

# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).

USE_CUDNN := 1

# CPU-only switch (uncomment to build without GPU support).

# CPU_ONLY := 1

# uncomment to disable IO dependencies and corresponding data layers

USE_OPENCV := 1

# USE_LEVELDB := 0

# USE_LMDB := 0

# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)

# You should not set this flag if you will be reading LMDBs with any

# possibility of simultaneous read and write

# ALLOW_LMDB_NOLOCK := 1

# Uncomment if you're using OpenCV 3

# OPENCV_VERSION := 3

# To customize your choice of compiler, uncomment and set the following.

# N.B. the default for Linux is g++ and the default for OSX is clang++

# CUSTOM_CXX := g++

# CUDA directory contains bin/ and lib/ directories that we need.

CUDA_DIR := /usr/local/cuda

# On Ubuntu 14.04, if cuda tools are installed via

# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:

# CUDA_DIR := /usr

# CUDA architecture setting: going with all of them.

# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.

# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.

# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.

CUDA_ARCH :=

? ? ? ? #-gencode arch=compute_20,code=sm_20 \

????????#-gencode arch=compute_20,code=sm_21 \

????????-gencode arch=compute_30,code=sm_30 \

????????-gencode arch=compute_35,code=sm_35 \

????????-gencode arch=compute_50,code=sm_50 \

????????-gencode arch=compute_52,code=sm_52 \

????????-gencode arch=compute_60,code=sm_60 \

????????-gencode arch=compute_61,code=sm_61 \

????????-gencode arch=compute_61,code=compute_61

# BLAS choice:

# atlas for ATLAS (default)

# mkl for MKL

# open for OpenBlas

BLAS := atlas

# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.

# Leave commented to accept the defaults for your choice of BLAS

# (which should work)!

BLAS_INCLUDE := /usr/include

BLAS_LIB := /usr/lib64

# Homebrew puts openblas in a directory that is not on the standard search path

# BLAS_INCLUDE := $(shell brew --prefix openblas)/include

# BLAS_LIB := $(shell brew --prefix openblas)/lib

# This is required only if you will compile the matlab interface.

# MATLAB directory should contain the mex binary in /bin.

# MATLAB_DIR := /usr/local

# MATLAB_DIR := /Applications/MATLAB_R2012b.app

# NOTE: this is required only if you will compile the python interface.

# We need to be able to find Python.h and numpy/arrayobject.h.

#PYTHON_INCLUDE := /usr/include/python2.7 \

/usr/lib/python2.7/dist-packages/numpy/core/include

#PYTHON_INCLUDE := /usr/include/python2.7 \

? ? ? ? ? ? ? ? /usr/lib64/python2.7/site-packages/numpy/core/include

#PYTHON_INCLUDE := /usr/local/python-3.6.1 \

? ? ? ? ? ? ? ? /usr/local/python-3.6.1/site-packages/numpy/core/include

# Anaconda Python distribution is quite popular. Include path:

# Verify anaconda location, sometimes it's in root.

ANACONDA_HOME := $(HOME)/anaconda2

PYTHON_INCLUDE := $(ANACONDA_HOME)/include \

$(ANACONDA_HOME)/include/python2.7 \

$(ANACONDA_HOME)/lib/python2.7/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

# Homebrew installs numpy in a non standard path (keg only)

# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include

# PYTHON_LIB += $(shell brew --prefix numpy)/lib

# Uncomment to support layers written in Python (will link against Python libs)

WITH_PYTHON_LAYER := 1

# Whatever else you find you need goes here.

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include

LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies

# INCLUDE_DIRS += $(shell brew --prefix)/include

# LIBRARY_DIRS += $(shell brew --prefix)/lib

# NCCL acceleration switch (uncomment to build with NCCL)

# https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)

USE_NCCL := 1

# Uncomment to use `pkg-config` to specify OpenCV library paths.

# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)

# USE_PKG_CONFIG := 1

# N.B. both build and distribute dirs are cleared on `make clean`

BUILD_DIR := build

DISTRIBUTE_DIR := distribute

# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171

# DEBUG := 1

# The ID of the GPU that 'make runtest' will use to run unit tests.

TEST_GPUID := 0

# enable pretty build (comment to see full commands)

Q ?= @



2.配置好環(huán)境開始導入發(fā)現(xiàn)導入缺少包

make clean

make all -j8?

make pycaffe

pycaffe 報錯


以python 2.7為例,anaconda2 中缺少atlas,openblas ,opencv ?

解決辦法?

conda install?atlas

conda install?opencv

conda instala?openblas=2.6.1

注意:

python 2.7 ?不支持 libprotobuf ,libopenblas ?如果報錯請刪除。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容