Python Forum

Full Version: PyQt5 Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This Is Code I AM Runing
from PyQt5.Widgets import *
Error:
Error:
Traceback (most recent call last): File "C:\Users\DELL\Desktop\Python_Projects\Learning PyQt5\PyQt5.py", line 1, in <module> from PyQt5.Widgets import * File "C:\Users\DELL\Desktop\Python_Projects\Learning PyQt5\PyQt5.py", line 1, in <module> from PyQt5.Widgets import * ModuleNotFoundError: No module named 'PyQt5.Widgets'; 'PyQt5' is not a package
Problem: How to solve this?
your file is named PyQt5.py - that's mistake because it override the package you want to use. Rename your file
(Aug-20-2020, 09:58 AM)buran Wrote: [ -> ]your file is named PyQt5.py - that's mistake because it override the package you want to use. Rename your file

Ok I Try It.

I got Problem file name is PyQt5.py I renamed to lol.py
But Another Problem Stand is
Error:

I got Problem file name is PyQt5.py I renamed to lol.py
But Another Problem Stand is
Error:
Traceback (most recent call last): File "c:\Users\DELL\Desktop\Python_Projects\Learning PyQt5\lol.py", line 1, in <module> from PyQt5.Widgets import * ModuleNotFoundError: No module named 'PyQt5.Widgets'
QtWidgets, not Widgets.

And from XXX import * is a really bad practice.
must be

from PyQt5.QtWidgets import *