matplotlib 画图的 Qt 问题

  1. This application failed to start because it could not find or load the Qt platform plugin “xcb” in “”.

    1
    export QT_PLUGIN_PATH="/data/software/anaconda2/plugins/"
  2. QXcbConnection: Could not connect to display

    方法一:

    • 设置环境变量
    1
    export QT_QPA_PLATFORM='offscreen'

    方法二:

    • python 画图脚本添加下面两行
    1
    2
    import matplotlib
    matplotlib.use('Agg')
---------本文结束,感谢您的阅读---------