Developer
Developer

Reputation: 141

Problems with running Qt on CentOS 7

from PyQt5.QtGui import QGuiApplication

app = QGuiApplication([])

When starting, it gives an error

qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.

Tell me how to fix this? I could not find it.

Upvotes: 0

Views: 4050

Answers (1)

Looks like the DISPLAY environment variable is not set. Are you running this from a graphical session? If you are running this over SSH you need to use X11 forwarding.

Assuming it is enabled on the server, you need to run ssh with the -X option.

You can find more information about this on ssh man page.

Upvotes: 2

Related Questions