【问题标题】:Caffe module installation failed in Windows 10在 Windows 10 中安装 Caffe 模块失败
【发布时间】:2017-07-10 12:27:52
【问题描述】:

我对咖啡很陌生。我正在关注这个链接: http://adilmoujahid.com/posts/2016/06/introduction-deep-learning-python-caffe/

当我运行这个命令时:python create_lmdb.py,我得到了以下错误:

文件“create_lmdb.py”,第 19 行,在,导入 caffe; ImportError:没有名为“caffe”的模块

我尝试使用此链接安装 caffe:https://github.com/BVLC/caffe/tree/windows,特别是以下代码:

    C:\Projects> git clone https://github.com/BVLC/caffe.git
    C:\Projects> cd caffe
    C:\Projects\caffe> git checkout windows
    :: Edit any of the options inside build_win.cmd to suit your needs
    C:\Projects\caffe> scripts\build_win.cmd

我收到以下错误:

    CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    See also "C:/Project_git/caffe/scripts/build/CMakeFiles/CMakeOutput.log".
    ERROR: Configure failed

我下载了 Ninja,但不知道如何处理它。于是我尝试将 WITH_NINJA=1 改为 WITH_NINJA=0,然后出现如下错误

    -- The C compiler identification is MSVC 19.0.24215.1
    -- The CXX compiler identification is MSVC 19.0.24215.1
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found PythonInterp: C:/Python34/python.exe (found suitable version "3.4.3", minimum required is "2.7")
    CMake Error at cmake/WindowsDownloadPrebuiltDependencies.cmake:29 (message):
      Could not find url for MSVC version = 1900 and Python version = 3.4.
     Call Stack (most recent call first):
      CMakeLists.txt:75 (include)
     -- Configuring incomplete, errors occurred!
    See also C:/Project_git/caffe/scripts/build/CMakeFiles/CMakeOutput.log".
    ERROR: Configure failed

请告诉我下一步应该做什么!提前致谢!

【问题讨论】:

    标签: python neural-network caffe conv-neural-network pycaffe


    【解决方案1】:

    步骤#1

    在 notepad++ 中打开 build_win.cmd 并更新文件行如下(禁用 Ninja build)

    :: Change to 1 to use Ninja generator (builds much faster)
    if NOT DEFINED WITH_NINJA set WITH_NINJA=0
    

    我正在使用 Microsoft Visual Studio 2013

    :: Change MSVC_VERSION to 12 to use VS 2013
    if NOT DEFINED MSVC_VERSION set MSVC_VERSION=12
    

    第二步

    打开 caffe 文件夹中的 build 文件夹并删除所有之前生成的文件。

    第 3 步

    官方不支持 Python 3.6,Python 3.5 存在一些具有挑战性的问题。对于初学者,我建议直接安装 python 2.7。

    Install anaconda 2.7 [Anaconda  2.7][1]
    

    第四步

    Execute scripts/build_win.cmd
    [1]: https://www.continuum.io/downloads
    

    重新格式化代码以便于阅读

    【讨论】:

    • 能用VS 2017 + Python 2.7编译caffe吗
    • 还在挣扎。 @JumabekAlikhanov 你成功了吗?
    猜你喜欢
    • 1970-01-01
    • 2019-05-20
    • 1970-01-01
    • 2021-03-08
    • 1970-01-01
    • 1970-01-01
    • 2013-12-01
    • 2021-07-29
    • 2018-10-12
    相关资源
    最近更新 更多