Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyQt5 Error
#1
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?
Reply
#2
your file is named PyQt5.py - that's mistake because it override the package you want to use. Rename your file
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(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'
Reply
#4
QtWidgets, not Widgets.

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

from PyQt5.QtWidgets import *
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 2,785 Apr-06-2019, 11:15 PM
Last Post: ZenWoR
  [PyQt] I get the error when I try to open the sample Why can pyqt5 installed onatdogan 3 3,044 Dec-25-2018, 03:00 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020