修改build_win.cmd如下:

  1.  
  1. @echo off
  2. @setlocal EnableDelayedExpansion
  3.  
  4. :: Default values
  5. if DEFINED APPVEYOR (
  6. echo Setting Appveyor defaults
  7. if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14
  8. if NOT DEFINED WITH_NINJA set WITH_NINJA=1
  9. if NOT DEFINED CPU_ONLY set CPU_ONLY=0
  10. if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto
  11. if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release
  12. if NOT DEFINED USE_NCCL set USE_NCCL=0
  13. if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=0
  14. if NOT DEFINED PYTHON_VERSION set PYTHON_VERSION=3
  15. if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=1
  16. if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=1
  17. if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=0
  18. if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python
  19. if NOT DEFINED RUN_TESTS set RUN_TESTS=0
  20. if NOT DEFINED RUN_LINT set RUN_LINT=0
  21. if NOT DEFINED RUN_INSTALL set RUN_INSTALL=0
  22.  
  23. :: Set python 2.7 with conda as the default python
  24. if !PYTHON_VERSION! EQU 2 (
  25. set CONDA_ROOT=d:\Miniconda-x64
  26. )
  27. :: Set python 3.5 with conda as the default python
  28. if !PYTHON_VERSION! EQU 3 (
  29. set CONDA_ROOT=D:\env\Anaconda3420
  30. )
  31. set PATH=!CONDA_ROOT!;!CONDA_ROOT!\Scripts;!CONDA_ROOT!\Library\bin;!PATH!
  32.  
  33. :: Check that we have the right python version
  34. !PYTHON_EXE! --version
  35. :: Add the required channels
  36. conda config --add channels conda-forge
  37. conda config --add channels willyd
  38. :: Update conda
  39. conda update conda -y
  40. :: Download other required packages
  41. conda install --yes cmake ninja numpy scipy protobuf==3.1.0 six scikit-image pyyaml pydotplus graphviz
  42.  
  43. if ERRORLEVEL 1 (
  44. echo ERROR: Conda update or install failed
  45. exit /b 1
  46. )
  47.  
  48. :: Install cuda and disable tests if needed
  49. if !WITH_CUDA! == 1 (
  50. call %~dp0\appveyor\appveyor_install_cuda.cmd
  51. set CPU_ONLY=0
  52. set RUN_TESTS=0
  53. set USE_NCCL=1
  54. ) else (
  55. set CPU_ONLY=1
  56. )
  57.  
  58. :: Disable the tests in debug config
  59. if "%CMAKE_CONFIG%" == "Debug" (
  60. echo Disabling tests on appveyor with config == %CMAKE_CONFIG%
  61. set RUN_TESTS=0
  62. )
  63.  
  64. :: Disable linting with python 3 until we find why the script fails
  65. if !PYTHON_VERSION! EQU 3 (
  66. set RUN_LINT=0
  67. )
  68.  
  69. ) else (
  70. :: Change the settings here to match your setup
  71. :: Change MSVC_VERSION to 12 to use VS 2013
  72. if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14
  73. :: Change to 1 to use Ninja generator (builds much faster)
  74. if NOT DEFINED WITH_NINJA set WITH_NINJA=0
  75. :: Change to 1 to build caffe without CUDA support
  76. if NOT DEFINED CPU_ONLY set CPU_ONLY=0
  77. :: Change to generate CUDA code for one of the following GPU architectures
  78. :: [Fermi Kepler Maxwell Pascal All]
  79. if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto
  80. :: Change to Debug to build Debug. This is only relevant for the Ninja generator the Visual Studio generator will generate both Debug and Release configs
  81. if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release
  82. :: Set to 1 to use NCCL
  83. if NOT DEFINED USE_NCCL set USE_NCCL=0
  84. :: Change to 1 to build a caffe.dll
  85. if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=0
  86. :: Change to 3 if using python 3.5 (only 2.7 and 3.5 are supported)
  87. if NOT DEFINED PYTHON_VERSION set PYTHON_VERSION=3
  88. :: Change these options for your needs.
  89. if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=1
  90. if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=1
  91. if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=0
  92. :: If python is on your path leave this alone
  93. if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python
  94. :: Run the tests
  95. if NOT DEFINED RUN_TESTS set RUN_TESTS=0
  96. :: Run lint
  97. if NOT DEFINED RUN_LINT set RUN_LINT=0
  98. :: Build the install target
  99. if NOT DEFINED RUN_INSTALL set RUN_INSTALL=0
  100. )
  101.  
  102. :: Set the appropriate CMake generator
  103. :: Use the exclamation mark ! below to delay the
  104. :: expansion of CMAKE_GENERATOR
  105. if %WITH_NINJA% EQU 0 (
  106. if "%MSVC_VERSION%"=="14" (
  107. set CMAKE_GENERATOR=Visual Studio 14 2015 Win64
  108. )
  109. if "%MSVC_VERSION%"=="12" (
  110. set CMAKE_GENERATOR=Visual Studio 12 2013 Win64
  111. )
  112. if "!CMAKE_GENERATOR!"=="" (
  113. echo ERROR: Unsupported MSVC version
  114. exit /B 1
  115. )
  116. ) else (
  117. set CMAKE_GENERATOR=Ninja
  118. )
  119.  
  120. echo INFO: ============================================================
  121. echo INFO: Summary:
  122. echo INFO: ============================================================
  123. echo INFO: MSVC_VERSION = !MSVC_VERSION!
  124. echo INFO: WITH_NINJA = !WITH_NINJA!
  125. echo INFO: CMAKE_GENERATOR = "!CMAKE_GENERATOR!"
  126. echo INFO: CPU_ONLY = !CPU_ONLY!
  127. echo INFO: CUDA_ARCH_NAME = !CUDA_ARCH_NAME!
  128. echo INFO: CMAKE_CONFIG = !CMAKE_CONFIG!
  129. echo INFO: USE_NCCL = !USE_NCCL!
  130. echo INFO: CMAKE_BUILD_SHARED_LIBS = !CMAKE_BUILD_SHARED_LIBS!
  131. echo INFO: PYTHON_VERSION = !PYTHON_VERSION!
  132. echo INFO: BUILD_PYTHON = !BUILD_PYTHON!
  133. echo INFO: BUILD_PYTHON_LAYER = !BUILD_PYTHON_LAYER!
  134. echo INFO: BUILD_MATLAB = !BUILD_MATLAB!
  135. echo INFO: PYTHON_EXE = "!PYTHON_EXE!"
  136. echo INFO: RUN_TESTS = !RUN_TESTS!
  137. echo INFO: RUN_LINT = !RUN_LINT!
  138. echo INFO: RUN_INSTALL = !RUN_INSTALL!
  139. echo INFO: ============================================================
  140.  
  141. :: Build and exectute the tests
  142. :: Do not run the tests with shared library
  143. if !RUN_TESTS! EQU 1 (
  144. if %CMAKE_BUILD_SHARED_LIBS% EQU 1 (
  145. echo WARNING: Disabling tests with shared library build
  146. set RUN_TESTS=0
  147. )
  148. )
  149.  
  150. if NOT EXIST build mkdir build
  151. pushd build
  152.  
  153. :: Setup the environement for VS x64
  154. set batch_file=!VS%MSVC_VERSION%0COMNTOOLS!..\..\VC\vcvarsall.bat
  155. call "%batch_file%" amd64
  156.  
  157. :: Configure using cmake and using the caffe-builder dependencies
  158. :: Add -DCUDNN_ROOT=C:/Projects/caffe/cudnn-8.0-windows10-x64-v5.1/cuda ^
  159. :: below to use cuDNN
  160. cmake -G"!CMAKE_GENERATOR!" ^
  161. -DBLAS=Open ^
  162. -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^
  163. -DBUILD_SHARED_LIBS:BOOL=%CMAKE_BUILD_SHARED_LIBS% ^
  164. -DBUILD_python:BOOL=%BUILD_PYTHON% ^
  165. -DBUILD_python_layer:BOOL=%BUILD_PYTHON_LAYER% ^
  166. -DBUILD_matlab:BOOL=%BUILD_MATLAB% ^
  167. -DCPU_ONLY:BOOL=%CPU_ONLY% ^
  168. -DCOPY_PREREQUISITES:BOOL=1 ^
  169. -DINSTALL_PREREQUISITES:BOOL=1 ^
  170. -DUSE_NCCL:BOOL=!USE_NCCL! ^
  171. -DCUDA_ARCH_NAME:STRING=%CUDA_ARCH_NAME% ^
  172. "%~dp0\.."
  173.  
  174. if ERRORLEVEL 1 (
  175. echo ERROR: Configure failed
  176. exit /b 1
  177. )
  178.  
  179. :: Lint
  180. if %RUN_LINT% EQU 1 (
  181. cmake --build . --target lint --config %CMAKE_CONFIG%
  182. )
  183.  
  184. if ERRORLEVEL 1 (
  185. echo ERROR: Lint failed
  186. exit /b 1
  187. )
  188.  
  189. :: Build the library and tools
  190. cmake --build . --config %CMAKE_CONFIG%
  191.  
  192. if ERRORLEVEL 1 (
  193. echo ERROR: Build failed
  194. exit /b 1
  195. )
  196.  
  197. :: Build and exectute the tests
  198. if !RUN_TESTS! EQU 1 (
  199. cmake --build . --target runtest --config %CMAKE_CONFIG%
  200.  
  201. if ERRORLEVEL 1 (
  202. echo ERROR: Tests failed
  203. exit /b 1
  204. )
  205.  
  206. if %BUILD_PYTHON% EQU 1 (
  207. if %BUILD_PYTHON_LAYER% EQU 1 (
  208. :: Run python tests only in Release build since
  209. :: the _caffe module is _caffe-d is debug
  210. if "%CMAKE_CONFIG%"=="Release" (
  211. :: Run the python tests
  212. cmake --build . --target pytest
  213.  
  214. if ERRORLEVEL 1 (
  215. echo ERROR: Python tests failed
  216. exit /b 1
  217. )
  218. )
  219. )
  220. )
  221. )
  222.  
  223. if %RUN_INSTALL% EQU 1 (
  224. cmake --build . --target install --config %CMAKE_CONFIG%
  225. )
  226.  
  227. popd
  228. @endlocal

  

  1.  

可能会报错:

Does not match the generator used previously: Ninja

在确认以上设置没有错误的情况下,删除生成的build文件夹并重启cmd即可。

caffe搭建--vs2015+caffe+python3.5编译环境的搭建的更多相关文章

  1. Java编译环境的搭建(eclipse)

    每用一种语言开发,要搭建其编译和开发环境,我们废话不说,立刻来看看Java开发环境的搭建. 1.安装JDK和JRE Windows环境下: a.去Oracle官网下载对应版本的JDK安装包,http: ...

  2. 第一篇:《UNIX 网络编程 第二版》编译环境的搭建

    第一步:搭建基本的编译环境 安装gcc, g++, bulid-essential等编译软件 第二步:下载本书示例源码包 第三步:解压下载到的包并放在用户主目录中 第四步:进入包内并执行以下命令 su ...

  3. 第一篇:《UNIX 环境高级编程》编译环境的搭建

    第一步:搭建基本的编译环境 安装gcc, g++, bulid-essential等编译软件 第二步:下载本书示例源码包 可在这里下载 www.apuenook.com 第三步:解压下载到的包并放在用 ...

  4. 《UNIX 环境高级编程》编译环境的搭建( 运行本专栏代码必读 )

    第一步:搭建基本的编译环境 安装gcc, g++, bulid-essential等编译软件 第二步:下载本书示例源码包 可在这里下载 www.apuenook.com 第三步:解压下载到的包并放在用 ...

  5. 《UNIX 网络编程 第二版》编译环境的搭建( 运行本专栏代码必读 )

    第一步:搭建基本的编译环境 安装gcc, g++, bulid-essential等编译软件 第二步:下载本书示例源码包 可在这里下载http://ishare.iask.sina.com.cn/f/ ...

  6. WebAssembly学习(二):Windows10下WebAssembly C/C++编译环境的搭建与Hello World尝试

    首先,不论是在Windows.Linux还是Mac上,Webassembly的编译都是主要依赖于Emscripten SDK这个工具的.但是,在这里必须要吐槽一下,不论是WebAssembly官网.W ...

  7. sublime text3配置Python2、Python3的编译环境

    由于Python2.Python3使用量都很高,Python3虽然是未来趋势,但是目前个别库还是只支持Python2.所以,很多人会选择在电脑上安装两个版本的Python,那么使用sublime执行代 ...

  8. Windows下QT4.8.4编译环境的搭建(转载http://blog.csdn.net/bestgonghuibin/article/details/38933141)

    开始使用QT了,所以第一步就是把环境搭起来,这里小记一下,以免以后忘记. 1. 下载安装文件 要使用QT功能,那么必须要下载QT的源码,还必须要一个是用QT的编译环境,可以是VS2010,也可以是专用 ...

  9. 搭建Ubuntu下c/c++编译环境【转】

    1.       安装Ubuntu. 2.       安装gcc 方法一: sudo apt-get  install  build-essential 安装完了可以执行 gcc--version的 ...

随机推荐

  1. C# Settings.settings的用处

    1.定义 在Settings.settings文件中定义配置字段.把作用范围定义为:User则运行时可更改,Applicatiion则运行时不可更改.可以使用数据网格视图,很方便: 2.读取配置值 t ...

  2. [CODEVS1915] 分配问题(最小费用最大流)

    传送门 脑残题 建图都懒得说了 ——代码 #include <queue> #include <cstdio> #include <cstring> #includ ...

  3. 如何在github上寻找漏洞

    https://github.com/search?p=2&q=eval%28%24_POST[&ref=searchresults&type=Code   1.$_GET s ...

  4. UVa11361 Investigating Div-Sum Property

    数位DP f[位数][自身模k余数][各位数字之和模k余数][当前位是否有上限]=方案数 k<10000,空间不够,如何优化? 不必优化,2^31以内,数字最多只有10位,各位数字之和最多为99 ...

  5. XML 增、删、改和查的实例【转】

    原文发布时间为:2008-08-10 -- 来源于本人的百度文章 [由搬家工具导入] 原文地址:http://www.cnblogs.com/skylaugh/archive/2006/12/18/5 ...

  6. html css的简单学习(三)

    html css的简单学习(三) 前端开发工具:Dreamweaver.Hbuilder.WebStorm.Sublime.PhpStorm...=========================== ...

  7. java parse 带英文单词的日期字符串(转化新浪微博api返回的时间)

    String str = "Sun Sep 23 00:32:57 +0800 2012"; SimpleDateFormat dateFormat = new SimpleDat ...

  8. Debian9安装MariaDB

    一:导入密钥并添加了存储库 sudo apt-get install software-properties-common dirmngr sudo apt-key adv --recv-keys - ...

  9. css查缺补漏2

    15.布局流程 一.确定页面的版心; 二.确定页面中的行模块,以及每个页面中的列模块 三.制作HTML结构 例:.top+.banner+(.main>.left+.right)+.footer ...

  10. CodeForces - 600F Edge coloring of bipartite graph

    Discription You are given an undirected bipartite graph without multiple edges. You should paint the ...