我最近安装了 Ubuntu 20.04 和 MATLAB 2021b。在运行脚本的过程中,MATLAB 崩溃了(该脚本没有任何问题,因为它在 Windows 上的 MATLAB 中运行良好)。
当我./matlab
在终端中输入时,我收到这些消息。
MATLAB is selecting SOFTWARE OPENGL rendering.
Gtk-Message: 08:28:19.310: Failed to load module "canberra-gtk-module"
MESA-LOADER: failed to open nouveau: /usr/lib/dri/nouveau_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: nouveau
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver
此后,MATLAB 开始工作。但如前所述,它在运行脚本时崩溃。我该怎么做才能阻止这些失败消息出现和/或阻止 MATLAB 崩溃?
答案1
我有 matlab 2021b 和 Ubuntu 20.04,在打开 matlab 时收到了相同的错误(还有一些其他错误)。我做了这两件事,它摆脱了与“acnberra-gtk-module”相关的错误:
- 确保已安装 canberra-gtk-module:
sudo apt install libcanberra-gtk-module
- 运行 matlab 之前输入:
export GTK_PATH=/usr/lib/x86_64-linux-gnu/gtk-2.0