windows10+VS2015+CPUonly+Caffe安装 填坑!!!

准备工作:

安装VS2015(网上基本上都是2013,我的电脑里之前装好的是2015,所以按照这个版本试一下)

Cmake 3.11.0

Python 2.7(我的电脑上原来安装了python3.6,参考了这篇博客 http://blog.csdn.net/dream_an/article/details/51248736 ,使python2,3共存)

cpu,不用安装cuda

下载caffe 地址 caffe-windows https://github.com/BVLC/caffe/tree/windows

下载依赖库 https://github.com/willyd/caffe-builder/releases 根据自己的版本下载


修改build_win.cmd

修改else 下的if NOT DEFINED CPU_ONLY set CPU_ONLY=0

为if NOT DEFINED CPU_ONLY set CPU_ONLY=1

并修改

if NOT DEFINED MSVC_VERSION setMSVC_VERSION=14

:: Change to 1 to use Ninja generator(builds much faster)

if NOT DEFINED WITH_NINJA set WITH_NINJA=0


运行build_win.cmd 编译




然后就是改错,填坑。。。windows真是麻烦,建议大家还是按照官方推荐,用VS2013吧

1.缺少windows sdk

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\caffe\caffe-windows\scripts\build\CMakeFiles\3.11.0-rc2\VCTargetsPath.vcxproj]
    已完成生成项目“C:\caffe\caffe-windows\scripts\build\CMakeFiles\3.11.0-rc2\VCTargetsPath.vcxproj”(默认目标)的操作 - 失败。

虽然他提示的是win8 sdk,我下载了win10的之后就可以了,或者你打开vs把一些你之前没下载的模块下载了之后就可以了

2.No CMAKE_C_COMPILER could be found.

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:18 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:18 (project):
  No CMAKE_CXX_COMPILER could be found.

这个问题我在网上查了半天说是路径有中文,但是我的安装是没有问题的。

解决:把 C:\Program Files (x86)\Windows Kits\8.1\bin\x64加到环境变量里面 

然后把C:\Program Files (x86)\Windows Kits\8.1\bin\x64里的

  1. rc.exe  
  2. rcdll.dll  
复制粘贴到你的VS安装目录VS2015\VC\bin里面,之后再执行一遍
  1. scripts\build_win.cmd  
 就可以了


3.Could NOT find Git (missing: GIT_EXECUTABLE)

windows安装git,很简单

4.CMake Error at cmake/Utils.cmake:69 (string):

修改caffe\cmake下Utils.cmake,第69行加引号

# Function merging lists of compiler flags to single string.
# Usage:
#   caffe_merge_flag_lists(out_variable <list1> [<list2>] [<list3>] ...)
function(caffe_merge_flag_lists out_var)
  set(__result "")
  foreach(__list ${ARGN})
    foreach(__flag ${${__list}})
      string(STRIP ${__flag} __flag)
      set(__result "${__result} ${__flag}")
    endforeach()
  endforeach()
  string(STRIP "${__result}" __result)
  set(${out_var} ${__result} PARENT_SCOPE)
endfunction()
5. Could NOT find Atlas (missing: Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY 

Atlas_LAPACK_LIBRARY) 


把BLAS值改成open



终于build完了!!!感动!!!


猜你喜欢

转载自blog.csdn.net/zqnnn/article/details/79453533