Re: pyqtdeploy application on windows with math module
"1004483092" <[email protected]> Tue, 17 Mar 2020 11:26:00 +0800
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
Hello Phil, I tried many times with diffirent ways, when I enabled the math module in standard library, the application report no module named math. when I add math module as extension module , the compiler kept reporting mathmodule.obj error LNK2019 , please tell me how to import math module , thank you! ------------------ Original ------------------ From: "Phil Thompson"<[email protected]>; Date: Mon, Mar 16, 2020 08:11 PM To: "1004483092"<[email protected]>; Cc: "pyqt"<[email protected]>; Subject: Re: [PyQt] pyqtdeploy application on windows with math module On 16/03/2020 10:41, 1004483092 wrote: > Hello Phil, > The math module build-in python use c modules , according to > Python-3.7.2\setup.py , the math module information as below: > shared_math = 'Modules/_math.o' > # complex math library functions > exts.append( Extension('cmath', ['cmathmodule.c'], > extra_objects=[shared_math], > depends=['_math.h', shared_math], > libraries=['m']) ) > # math library functions, e.g. sin() > exts.append( Extension('math', ['mathmodule.c'], > extra_objects=[shared_math], > depends=['_math.h', shared_math], > libraries=['m']) ) > > > Can you tell me how to import the math module on windows via > pyqtdeploy? thank you! Enable the module in the pyqtdeploy GUI. Phil > ------------------&nbsp;Original&nbsp;------------------ > From:&nbsp;"Phil Thompson"<[email protected]&gt;; > Date:&nbsp;Mon, Mar 16, 2020 03:55 PM > To:&nbsp;"1004483092"<[email protected]&gt;; > Cc:&nbsp;"pyqt"<[email protected]&gt;; > Subject:&nbsp;Re: [PyQt] pyqtdeploy application on windows with math > module > > > > I have no idea what that DLL is. pyqtdeploy supports the standard > Python > math module. If you do not have lots of experience building and > debugging C++ code on Windows then please use something else. > > Phil > > On 16/03/2020 03:37, 1004483092 wrote: > &gt; Hello Phil,I build the demo on windows10 with VS2017 success > according > &gt; to the document , but when my python script include math module , > the > &gt; application can't import math module.The math module is > &gt; api-ms-win-crt-math-l1-1-0.dll on windows , can you tell me how to > &gt; import math module via pyqtdeploy?My scripyt as below:from > &gt; PyQt5.QtCore import * > &gt; from PyQt5.QtGui import * > &gt; from PyQt5.QtWidgets import * > &gt; import sys > &gt; import mathclass Window(QWidget): > &gt;&nbsp;&nbsp;&nbsp;&nbsp; def __init__(self): > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super().__init__() > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setupUI() > &gt; > &gt;&nbsp;&nbsp;&nbsp;&nbsp; def setupUI(self): > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > self.lb=QLabel(self) > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > self.lb.setText('Label') > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > self.lb.move(30,10) > &gt; > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.btn = > QPushButton('test',self) > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > self.btn.move(30,30) > &gt; > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.cb = > QComboBox(self) > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > self.cb.move(30,70) > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > self.cb.resize(200,30) > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.resize(30,80) > &gt; > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > self.btn.clicked.connect(self.test_func) > &gt; > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > self.setWindowTitle('test') > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > self.setGeometry(400, 400, 300, 300)&nbsp;&nbsp;&nbsp; def > test_func(self): > &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test1 = > math.cos(30)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test2 = > math.asinh(60)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test3 = > &gt; math.exp(40.1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test4 = > math.expm1(5.23)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test5 = > &gt; math.factorial(40)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > test6 = math.isfinite(3.24) > &gt; self.cb.addItems([f'{test1}', f'{test2}', f'{test3}', f'{test4}', > &gt; f'{test5}', f'{test6}'])if __name__=='__main__': > &gt;&nbsp;&nbsp;&nbsp;&nbsp; app = QApplication(sys.argv) > &gt;&nbsp;&nbsp;&nbsp;&nbsp; window=Window() > &gt;&nbsp;&nbsp;&nbsp;&nbsp; window.show() > &gt;&nbsp;&nbsp;&nbsp;&nbsp; sys.exit(app.exec_()) > &gt; _______________________________________________ > &gt; PyQt mailing list&nbsp;&nbsp;&nbsp; [email protected] > &gt; https://www.riverbankcomputing.com/mailman/listinfo/pyqt _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[email protected]
(image/jpeg, 15.4 KB) - not displayed
[email protected]
(image/jpeg, 26.4 KB) - not displayed