Как правильно установить библиотеки QT в 2024 году? Создатель QTPython

Программы на Python
Anonymous
Как правильно установить библиотеки QT в 2024 году? Создатель QT

Сообщение Anonymous »


I'm a beginner and thought that writing apps in QT Creator will be as easy as working with vanilla Python in VSCode & installing packages to venv with pip. Sadly that's not in case.

I want to create a desktop app in Qt Quick with charts, plots and animations. I downloaded the QT online installer and chose the following installation template:
Изображение


Then, in the QT Maintenance application, I ticked the 'QTCharts' box under QT/6.6.2/Additional Libraries and installed it.


Изображение



Изображение


I created a new Project in QT Creator with an empty QT Quick window. Launched it, it worked (why wouldn't it?). I then added the import statement for QTCharts in the main.qml file:

import QtQuick import QtQuick.Window import QtCharts Window { width: 640 height: 480 visible: true title: qsTr("Hello World") } but when I ran it via the QT Creator UI, it simply logged: '\venv\Scripts\python.exe exited with code -1'. Surprised by the lack of details, I ran the app via cmd which outputted more information:

"main.qml:3:1: module "QtCharts" is not installed".
Quick google led me to adding the following:

engine.addImportPath("C:\Qt\\6.6.2\mingw_64\qml") to the main.py file. This resulted in yet another error:

main.qml:3:1: Cannot load library C:\Qt\6.6.2\mingw_64\qml\QtCharts\qtchartsqml2plugin.dll: The specified module could not be found.

but the file does indeed exist:
Изображение


so this made me stop. I'm not doing it right, there should be an easier way. I've got many libraries to install, some external ones too, so I need to know a straightforward way of adding them to my project. Please, could anyone explain what I'm doing wrong?

Windows 10, Python 3.11


Источник: https://stackoverflow.com/questions/780 ... qt-creator

Вернуться в «Python»