pyqt: Fix PYTHONPATH for Python 3

The previous fix broke Python 3 support. This fix incorporates the previous fix, but also fixes Python 3 support.

Fixes problems introduced in #26510