1. 程式人生 > >windows10+VS2015+CPUonly+Caffe安裝 填坑!!!

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

下載依賴庫 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完了!!!感動!!!