In case you are trying to start a graphical application with "sudo", read this article in order to avoid this issue:
https://blog.mobatek.net/post/how-to-keep-X11-display-after-su-or-sudo/
Unable to init server: Could not connect: Connection refused
(Camera FPS:13036): Gtk-WARNING **: 00:43:18.718: cannot open display: localhost:10.0
解决办法:
普通用户报错,root用户不报错的解决方法:
cp /root/.Xauthority /home/orangepi/
普通用户不报错,root用户报错的解决方法:
cp /home/orangepi/.Xauthority /root/
orangepi为用户名