Python Forum

Full Version: So lost
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have no idea how to install pyqt 4 everything i find online doesnt help because what it tells me to do doesnt work. i dont know where im supposed to put the sip files or the pyqt4 files.....

they say goto cmd and type in python configure-ng.py well it tells me its not in directories

if i run the configure-ng.py from the files i downloaded it says qmake files not in directory. so i try to do what they say to make it find qmake files and use --qmake or --q and it still doesnt work

if i run the file configure in the pyqt4 files it says i need a sip version 4.19.12 installed, and that is the version i installed...
pip install pyqt4
above will automatically install for the python in path,
if using python3, to make sure, use:
pip3 install pyqt4
do this from command line. pyqt5 is latest, and what you should use.
I will try pyqt5. I was just watching a intro tutorial to gui and that's what he used. Could have been before pyqt5. I did try to do that at first with pyqt and it wouldnt install. However I didn't know anything about pipe could have been the problem

C:\Users\mjona>pip3 install pyqt5
Requirement already satisfied: pyqt5 in c:\users\mjona\appdata\local\programs\python\python37-32\lib\site-packages (5.11.2)
Requirement already satisfied: PyQt5_sip<4.20,>=4.19.11 in c:\users\mjona\appdata\local\programs\python\python37-32\lib\site-packages (from pyqt5) (4.19.12)



say there is no module for pywt5
do

Quote:pip3 show pyqt5

my output is

Output:
Name: PyQt5 Version: 5.11.2 Summary: Python bindings for the Qt cross platform UI and application toolkit Home-page: https://www.riverbankcomputing.com/software/pyqt/ Author: Riverbank Computing Limited Author-email: info@riverbankcomputing.com License: GPL v3 Location: /home/brian/.local/lib/python3.6/site-packages Requires: PyQt5-sip Required-by:
if your output is not empty try an example

from PyQt5.QtWidgets import (QApplication, QMainWindow, QMessageBox)

class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle("Test")
        self.setGeometry(50, 50, 250, 150)


    def msgbox(self, message):
        QMessageBox.information(self, "Message", message)


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    mainWin = MainWindow()
    mainWin.show()
    mainWin.msgbox("it works")
    sys.exit(app.exec_())

I ran pip3 show pyqt5 and pyqt5-sip and got the same results as you.


This is the error it gives me with your exact code.

Traceback (most recent call last):
File "C:/Users/mjona/PycharmProjects/untitled/test projects/gui test.py", line 1, in <module>
from PyQt5.QtWidgets import (QApplication, QMainWindow, QMessageBox)
ModuleNotFoundError: No module named 'PyQt5'

Process finished with exit code 1
Did you run gui test.py with python 3 ?
import sys

print(sys.version)

from PyQt5.QtWidgets import (QApplication, QMainWindow, QMessageBox)


class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle("Test")
        self.setGeometry(50, 50, 250, 150)

    def msgbox(self, message):
        QMessageBox.information(self, "Message", message)


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    mainWin = MainWindow()
    mainWin.show()
    mainWin.msgbox("it works")
    sys.exit(app.exec_())
I have it printing the python version. as far as i can tell i am using python 3


C:\Users\mjona\PycharmProjects\untitled\venv\Scripts\python.exe "C:/Users/mjona/PycharmProjects/untitled/test projects/gui test.py"
Traceback (most recent call last):
3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
File "C:/Users/mjona/PycharmProjects/untitled/test projects/gui test.py", line 5, in <module>
from PyQt5.QtWidgets import (QApplication, QMainWindow, QMessageBox)
ModuleNotFoundError: No module named 'PyQt5'

Process finished with exit code 1

PyQt5 is probably installed into site-packages and not dist-packages.

You must verify your PYTHONPATH, and add site-package if needed.

export PYTHONPATH=$PYTHONPATH:/usr/lib/python3.2/site-packages (adapt
the path)


this is the only thing i have found that could actually be my problem, but i have tried what is says to do, and i cant figure it out. i copied the code, and put the location of site packages on my pc....
If you use venv, then you must install pyqt5 in it.
i copied everything from site packages to a folder in site-packages, and put it in a folder named PyQt5 in Lib.

no this is the error


Traceback (most recent call last):
File "C:/Users/mjona/PycharmProjects/untitled/test projects/gui test.py", line 3, in <module>
from PyQt5.QtGui import QPalette, QKeySequence, QIcon
ModuleNotFoundError: No module named 'PyQt5.QtGui'

Process finished with exit code 1

(Sep-23-2018, 04:00 PM)Axel_Erfurt Wrote: [ -> ]If you use venv, then you must install pyqt5 in it.

I uninstalled pyqt5 and pyqt5-sip it still sisnt work. so i moved all the files in site packages to Lib and it works. thanks for all the help.
you should install it in venv with pip.

https://packaging.python.org/guides/inst...irtualenv/
Pages: 1 2