最新最全caffe2在win10下安装与在vs2015下编译(包括cuda、cmake、anaconda)

  1. 安装 Visual Studio 2015
  2. 安装 CUDA 8.0
  3. 安装 cuDNN
  4. 安装 CMAKE
  5. 安装 Anaconda及Python
  6. 下载GIT克隆caffe2
  7. 编译
  8. 安装caffe2

文章主要参考另外两篇博客写的,安装、编译出问题查看这两个博客:

https://blog.csdn.net/qwfzpk/article/details/79112097

https://blog.csdn.net/sin574/article/details/78760697


1.安装visual studio 2015

直接去官网下载

注意:要选自定义,根据需要自行选择,一般要选  语言-C++。

2.安装 CUDA 8.0


注意:1.一定要保证之前安装了visual studio,这样CUDA才会根据vs版本进行安装

           2.先安装  Base Installer  再安装Patch2

3.安装 cuDNN

下载地址:

4.安装CMAKE

下载地址:https://cmake.org/download/


点击安装后需要选择将CMAKE添加到系统PATH路径中,免去配置环境变量的过程 


5.安装Anaconda

下载地址:https://www.anaconda.com/download/#windows

安装Anaconda的过程中同样需要注意勾选将Anaconda添加到系统路径中

6.下载GIT克隆caffe2

运行GIT,复制粘贴运行一下代码:
git clone --recursive https://github.com/pytorch/pytorch.git

7.编译

根据https://blog.csdn.net/sin574/article/details/78760697修改

build_host_protoc.bat 、build_windows.bat 并执行 注意第二个文件执行时间很长,我用了大约一个小时,请耐心等待。

用VS打开.../build/Caffe2.sln,

右击caffe2_pybind11_state和 caffe2_pybind11_state_gpu添加 附加库目录:

在 Properties-->Linker --> General --> Additional Library Directories 添加你安装的anaconda文件夹的路径,如:E:\Program Files\anaconda3\libs

右击ALL BUILD,点击生成

8.安装Caffe2
右击 INSTALL 项目,生成
完成之后会在 C:\Program Files 出现 Caffe2 文件夹
将 CAFFE2_ROOT\build\caffe2\python\Release 下的 
caffe2_pybind11_state.pyd 和 caffe2_pybind11_state_gpu.pyd 拷贝到 C:\Python27\DLLs
配置环境变量: PYTHONPATH = CAFFE2_ROOT\build 或者
PYTHONPATH = C:\Program Files\caffe2

至此,caffe2就安装编译完成了。另外还需要一些python文件跑MNIST,通过cmd命令,conda install 文件名来下载,一定要用清华镜像,速度快不易出错。地址:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/。安装成功后,进入caffe官网学习新手教程https://caffe2.ai/docs/tutorials.html


Anaconda users: If you’re using Anaconda, use conda install instead of pip install.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
pip install -U pip setuptools
pip install \
    graphviz \
    hypothesis \
    ipython \
    jupyter \
    matplotlib \
    notebook \
    pydot \
    python-nvd3 \
    pyyaml \
    requests \
    scikit-image \
    scipy









猜你喜欢

转载自blog.csdn.net/qq_27012963/article/details/80136769