ubuntu16.04 python3.6 安装caffe
首先记得在Makefile.config和Makefile里改一下PYTHON_INCLUDE 和 LIBRARY 网上一搜一大堆
然后记得在Makefile.config中把python版本替换下,注释掉python2.7那一块, uncomment掉python3那一块. 仔细读注释
最后make pycaffe时遇到问题
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
/usr/bin/ld: cannot find -lboost_python3-py35
collect2: error: ld returned 1 exit status
Makefile:507: recipe for target 'python/caffe/_caffe.so' failed
make: *** [python/caffe/_caffe.so] Error 1
这是因为不同ubuntu/python版本中usr/lib中动态库.so文件名不一样.
以我ubuntu16.04 Python3.6条件下, caffe需要使用的动态库名称为libboost_python-py35而不是config文件中的libboost_python3 因此将Makefile.config中的boost_python3改为boost_python-py35
参考:https://github.com/BVLC/caffe/issues/4843
之后import caffe后又出现错误
File "/usr/local/lib/python3.6/dist-packages/dateutil/rrule.py", line 55
raise ValueError, "Can't create weekday with n == 0"
^
SyntaxError: invalid syntax
解决方法: 不知道什么原理
- pip install python-dateutil --upgrade