matlab_gtsam环境配置

gtsam-matlab环境配置

主要参考博客

matlab使用gtsam工具箱:https://blog.csdn.net/subiluo/article/details/120034253

按照上述博客操作

实际安装过程中存在的问题

  • 注意使用较高版本gtsam的cmake参数-DMATLAB_ROOT应改为-DMatlab_ROOT_DIR,若前者不启用则尝试后者

  • gtsam的版本不宜过高,我是用的4.2.0,太高可能会出现link lib error

    我自己用的版本下载链接:https://cloud.tsinghua.edu.cn/f/7deedbe0109e44bd889f/

  • 安装gtsam时ubuntu的python环境须为python3,在Python2环境下会出现syntax error

安装python3.8见 https://blog.csdn.net/weixin_42955871/article/details/123088247

  • 注意安装在系统目录一定要使用sudo make install

  • 出现no module named pyparsing,需安装pyparsing库:pip install pyparsing

见https://blog.csdn.net/qq_29579431/article/details/99236119

注意,这里不能使用pip3安装,须用pip。

若pip报错为main相关,则按照以上博客更改

sudo gedit /usr/bin/pip

若pip中出现no module问题,需要回到python2环境中pip install该库;

切换python环境的方法1:

sudo rm /usr/bin/python
sudo ln -s /usr/local/python3/bin/python3.8(你的python所在位置) /usr/bin/python

切换python环境的方法2:

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2 # 添加Python2可选项,优先级为2
$ sudo update-alternatives --install /usr/bin/python python /usr/local/python3/bin/python3.8 1 #添加Python3可选项,优先级为1

sudo update-alternatives --config python

输出为

root@ubuntu:/usr/bin# sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/python2.7   2         auto mode
  1            /usr/bin/python2.7   2         manual mode
* 2            /usr/bin/python3.8   1         manual mode

Press <enter> to keep the current choice[*], or type selection number: 

输入数字切换版本

出现其他“no module”问题都用pip自行安装即可

  • “在matlab文件夹下删除或者重命名前缀是libstdc++相关的文件”这一步是官方文档上的内容,

    If you have a newer Ubuntu system (later than 10.04), you must make a small modification to your MATLAB installation, due to MATLAB being distributed with an old version of the C++ standard library. Delete or rename all files starting with libstdc++ in your MATLAB installation directory, in paths:

    /usr/local/MATLAB/[version]/sys/os/[system]/
    /usr/local/MATLAB/[version]/bin/[system]/
    
    

但如果matlab版本新,所使用的c++标准库是高版本的,这样的话就不要做这一步,在以上两个目录中查看libstdc++.so的版本,高于libstdc++.so.6版本就不要改了。低版本就按照官方文档改。

  • 所有安装完成后,可切换回python2环境,不影响正常使用。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值