- 环境:windows10+visual studio 2019 (请先看第二个“最终失败”的原因,虽然博主失败了,但如果有适合条件的同学,可以试一下,因为下方尝试的方案都是我逐步查询了很久的)
- caffe是一种框架,使用c++编写的。
- 直接终端安装caffe GPU版本:conda install caffe -c willyd(失败)
- 耗费时间很长,结果报错:
Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
- 查询到的解决方法:将conda改为pip,报错:
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'willyd'
- 去掉-c willyd,当做简单的安装一个包,报错:
ERROR: Could not find a version that satisfies the requirement caffe (from versions: none) ERROR: No matching distribution found for caffe
- 尝试更换镜像源,下方列出了带着镜像源pip,以及尝试了的多个镜像源:
pip install caffe -i http://pypi.mirrors.ustc.edu.cn/simple/ 常用镜像源: http://pypi.doubanio.com/simple/ 豆瓣镜像网站 http://pypi.douban.com/simple/ 豆瓣 https://pypi.tuna.tsinghua.edu.cn/simple/ 清华大学 http://mirrors.aliyun.com/pypi/simple/ 阿里云 https://pypi.mirrors.ustc.edu.cn/simple/ 中国科技大学 http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学
- 最终失败~,结论:caffe不是一个普普通通的package
- 耗费时间很长,结果报错:
- 源码安装:
-
百度网盘下载:
-
链接:https://pan.baidu.com/s/1cHneN0eJxlj-jS1Odqh39g
-
提取码:fhyo
-
-
编译builder(为适配vs2019)
-
打开x64 native tools command prompt(注意不是普通的cmd,每一步坑都是细节)
-
cd 到caffe-build目录下
-
此处会出现windows使用cd 无效的情况,解决方法:
-
cd 路径 再输入路径中的盘符:(根据实际),如 d:
- 在要跳转的路径前加上参数 /d (这是一个强制跳转参数),如果进入的是当前目录的子目录,则可以不使用 /d 参数
-
-
- 然后执行build-VS2019.bat
- 等待~~,等出现下图时,等待结束:
- 点击打开caffe-builder.sln
- 编译项目:ALL_BUILD(右键生成),INSTALL(右键生成)
-
- 编译源码:
- 解压caffe-windows.zip
- 打开:caffe-windows\caffe-windows\cmake\ WindowsDownloadPrebuiltDependencies.cmake
- 将脚本用#[[ ]]全部注释掉,在最后加一行:
include(F:/caffe/caffe-build-auto/caffe-builder/build/libraries/caffe-builder-config.cmake)
- caffe-builder-config.cmake为第一节编译时产生。
- 将脚本用#[[ ]]全部注释掉,在最后加一行:
- 打开caffe\caffe-build-auto\caffe-builder\build\libraries\OpenCVConfig.cmake,在129行添加:
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/lib")
- 使用cmake进行编译:
- 把BLAS的Atlas改为Open
- add entry
PYTHON_EXECUTABLE value: 要配置的python.exe路径
- 最终失败,原因:实际想要适配自己本地的python 3.8.x,但最终只能适配python 2版本,如果你的版本刚好合适,则看下一步,否则抱歉浪费您的时间了,此文仅做遇坑记录。
- configure done->generate done-> open
- 编译项目:ALL_BUILD(右键生成),INSTALL(右键生成)(应该就可以了,因为我这边没成功,所以只是“应该”)
-
caffe安装探索整理
于 2022-09-13 11:05:16 首次发布