win10+visual studio2017编译caffe

目前微软不提供visual studio 2017以外 的版本下载,根据caffe官方文档说明必须用2013或者2015版本进行编译。

我没有安装gpu什么的,也就是安照官网上面最基本的配置去装的。
找到的这篇博客非常有用,在visual studio 2017版本上编译,参考其中的部分步骤。

但是即使有参考,编译的过程也不是一帆风顺。以下是我遇到的问题,以及记录的解决办法:

1. 编译过程中出现错误:.caffe Could NOT find PythonInterp: Found unsuitable version "1.4"

解决:删除 caffe/build/CMakeFiles, 如果有Cmakecache.txt也一起删了
参考:https://stackoverflow.com/questions/48033451/caffe-installation-doesnt-find-python-3-5-even-if-it-is-installed-and-labeled-i?rq=1

2. 编译过程中出现错误信息:fatal error C1083: 无法打开包括文件: “caffe/include_symbols.hpp”

解决: 有一行(本文的版本是第74行) if NOT DEFINED WITH_NINJA set WITH_NINJA=1 改为 set WITH_NINJA=1
参考:https://blog.csdn.net/ououming123/article/details/78832581

3. 运行工程的过程中遇到:

Could not find a version that satisfies the requirement cv2 (from versions: )
	Could not find a version that satisfies the requirement cv2 (from versions: )
		No matching distribution found for cv2
If you are using python 2 you can install with pip:
 pip install opencv-python
Or use the equivilent for python 3: 

解决:错误信息里面已经很详细了pip install opencv-python

4. 运行工程的过程中遇到:

ImportStringError: import_string() failed for 'config'. Possible reasons are
\- missing __init__.py in a package;
\- package or module path not included in sys.path;
\- duplicated package or module name taking precedence in sys.path;
\- missing module, class, function or variable;

Debugged import:

\- 'config' not found.

Original exception:

ImportError: No module named config

解决:根据给出的错误信息和网上的资料可以得出可能当前工程缺少一些文件。登陆到部署代码的原服务器,对比之后发现确实缺少一些文件。添加之后,运行成功。

祝大家编译之旅一帆风顺!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章