目前微軟不提供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
解決:根據給出的錯誤信息和網上的資料可以得出可能當前工程缺少一些文件。登陸到部署代碼的原服務器,對比之後發現確實缺少一些文件。添加之後,運行成功。
祝大家編譯之旅一帆風順!