Table of Contents:

在linux 服务器上面运行代码 

出现  QXcbConnection: Could not connect to display  这样的错误

首先 

vim ~/.bashrc

然后在里面添加 

export QT_QPA_PLATFORM='offscreen'

即时生效

source ~/.bashrc

这样就可以额

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.

#!/bin/bash
# seismic-system-launcher.sh

# Set Qt environment
export QT_QPA_PLATFORM=xcb
export QT_QPA_PLATFORM_PLUGIN_PATH=/opt/Qt5.15.2/5.15.2/gcc_64/plugins
export LD_LIBRARY_PATH=/opt/Qt5.15.2/5.15.2/gcc_64/lib:$LD_LIBRARY_PATH
export DISPLAY=:0

cd /xxx/yy
zz