PyQt5 Installation - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: PyQt5 Installation (/thread-24298.html) |
PyQt5 Installation - Clamantium - Feb-07-2020 I am trying to teach myself to code in Python using various resources and want to create my first, very simple, desktop application. I have no coding experience and do not know any other languages. I have, as far as I can tell, loaded PyQt5 onto my Windows computer. I have Python version 3.7. I began by setting up a basic structure for the code. Guided by one of my learning resources I input: [Python] from PyQt5.QtCore import * from PyQt5.QtGui import * import sys app = QApplication(sys.argv) dialog = QDialog() dialog.show() app.exec_() [\Python] The result is: C:\Users\BLACKBURNT\PycharmProjects\Pluralsight\venv\Scripts\python.exe C:/Users/BLACKBURNT/PycharmProjects/Pluralsight/structure.py Traceback (most recent call last): File "C:/Users/BLACKBURNT/PycharmProjects/Pluralsight/structure.py", line 1, in <module> from PyQt5.QtCore import * ModuleNotFoundError: No module named 'PyQt5' Process finished with exit code 1 I do not know what I have done wrong when installing PyQt5. Can anyone help me please? RE: PyQt5 Installation - Axel_Erfurt - Feb-07-2020 How did you install PyQt5? RE: PyQt5 Installation - snippsat - Feb-07-2020 (Feb-07-2020, 08:08 PM)Clamantium Wrote: venv\Scripts\python.exeYou are now running from virtual environment venv. This mean that PyQt5 most be installed first in this environment. Configure a Python interpreter here can you point Interpreter to OS version of Python,that i guess you have installed PyQt5 to. Quick demo of venv .# Make E:\div_code λ python -m venv pyqt5_env # Cd in E:\div_code λ cd pyqt5_env\ # Activate E:\div_code\pyqt5_env λ E:\div_code\pyqt5_env\Scripts\activate # Install (pyqt5_env) E:\div_code\pyqt5_env λ pip install PyQt5 Collecting PyQt5 Downloading .... Successfully installed PyQt5-5.14.1 PyQt5-sip-12.7.1 # Test that it wok (pyqt5_env) E:\div_code\pyqt5_env λ python Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from PyQt5.QtWidgets import QApplication, QWidget >>> >>> exit()So if i was using PyCharm(which i am not) could point interpreter to E:\div_code\pyqt5_env\Scripts\python.exe Then it will work PyCharm for this environment,and eg not for OS python if not also have installed PyQt5 there. |