make pycaffe : /usr/bin/ld: cannot find -lboost_python3

本文介绍了如何在Ubuntu16.04系统中使用Python3.6安装Caffe的过程,重点讲解了配置Makefile.config文件的方法,并解决了make pycaffe时遇到的动态库链接错误及后续导入caffe模块时出现的语法错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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



解决方法: 不知道什么原理

  1. pip install python-dateutil --upgrade  


[ 98%] Built target my_ros2_proto__rosidl_typesupport_introspection_c__pyext /usr/bin/ld: skipping incompatible /home/byd/X1/agibot_x1_infer-main/src/module/joy_stick_module/third_party/lib/libqpOASES.so when searching for -lqpOASES /usr/bin/ld: cannot find -lqpOASES: No such file or directory /usr/bin/ld: skipping incompatible [ 98%] Built target my_ros2_proto__rosidl_typesupport_c__pyext /home/byd/X1/agibot_x1_infer-main/src/module/joy_stick_module/third_party/lib/libqpOASES.so when searching for -lqpOASES /usr/bin/ld: skipping incompatible /home/byd/X1/agibot_x1_infer-main/src/module/control_module/third_party/lib/libruckig.so when searching for -lruckig /usr/bin/ld: cannot find -lruckig: No such file or directory /usr/bin/ld: skipping incompatible /home/byd/X1/agibot_x1_infer-main/src/module/control_module/third_party/lib/libruckig.so when searching for -lruckig [ 99%] Built target aimrt_protocols_sensor_pb_gencode [100%] Built target xyber_x1_infer_example_proto_pb_gencode [100%] Built target ament_cmake_python_build_ros2_plugin_proto_egg [100%] Built target ament_cmake_python_build_my_ros2_proto_egg /usr/bin/ld: skipping incompatible /home/byd/X1/agibot_x1_infer-main/src/module/control_module/third_party/lib/libonnxruntime.so when searching for -lonnxruntime /usr/bin/ld: skipping incompatible /home/byd/X1/agibot_x1_infer-main/src/module/sim_module/third_party/lib/libmujoco.so when searching for -lmujoco /usr/bin/ld: cannot find -lmujoco: No such file or directory /usr/bin/ld: skipping incompatible /home/byd/X1/agibot_x1_infer-main/src/module/sim_module/third_party/lib/libmujoco.so when searching for -lmujoco collect2: error: ld returned 1 exit status gmake[2]: *** [src/pkg/pkg1/CMakeFiles/xyber_x1_infer_pkg1.dir/build.make:248: libpkg1.so] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:3121: src/pkg/pkg1/CMakeFiles/xyber_x1_infer_pkg1.dir/all] Error 2 gmake: *** [Makefile:166: all] Error 2
最新发布
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值