PyCharm, PyQt5, and Raspberry Pi 3
Is there a concrete example where PyCharm is used to develop a PyQt5 application that runs on the Raspberry Pi 3?
I am able to create a PyQt5 based project in the Windows environment with no problem but I am unable to change the environment to the Raspberry Pi and run the project without errors.
The first issue that I encountered when changing the environment to the RPi was that PyQt5 would not install (pip install PyQt5). I was able to overcome this by building PyQt5 on the Raspberry Pi. After the PyQt5 build on the RPi, auto code completion worked indicating that PyQt5 was exposed. I also saw PyQt5 in the Lib site-packages.
When I run this project (see code below) I get the following:
ssh://pi@192.168.0.211:22/usr/bin/python3 -u /home/pi/pyprojects/Remote/remote.py
QXcbConnection: Could not connect to display
bash: line 1: 2666 Aborted env -i "PYTHONUNBUFFERED"="1" "PYTHONPATH"="/home/pi/.pycharm_helpers/pycharm_matplotlib_backend:/home/pi/pyprojects/Remote" "PYCHARM_HOSTED"="1" "JETBRAINS_REMOTE_RUN"="1" "PYCHARM_MATPLOTLIB_PORT"="50836" "PYTHONIOENCODING"="UTF-8" /usr/bin/python3 -u /home/pi/pyprojects/Remote/remote.py
Process finished with exit code 134
# Simple example for the use of PyQt5
import sys
from PyQt5.QtWidgets import QApplication, QWidget
if __name__ == '__main__':
app = QApplication (sys.argv)
w = QWidget ()
w.resize (250, 150)
w.move (300, 300)
w.setWindowTitle ('Simple')
w.show ()
sys.exit (app.exec_ ())
Please sign in to leave a comment.