[PyQt] 回复: pyqtdeploy application on windows with math module

1004483092 1004483092 at qq.com
Tue Mar 17 10:25:34 GMT 2020


I think it has no matter with debug C++ code kills , according to the manual , I had compiled pyqt script success with pyqtdeploy v2.4.


But I find it have problems when I import standard python module math or random , why the standrad python library can't be found , it has been checked in pyqtdeploy GUI as you said , where's the problem ?


I have a friend who has many years of experience in C + + development and created a pyqt forum, 
I asked for help about the problem in his forum for a long time but no one knows the right way , he told me not to waste time on this tool.
He compiled his project success with pyqtdeploy 1.3 before , but he don't want to use pyqtdeploy anymore , it takes too much time to learn pyqtdeploy but the efficiency don't  improved too much, and v2.x changed a lot .


In other hand there are few successful cases running in windows with pyqtdeploy v1.x but no one in pyqtdeply 2.x , as the manual are not detailed enough.




------------------ 原始邮件 ------------------
发件人: "Phil Thompson"<phil at riverbankcomputing.com>;
发送时间: 2020年3月17日(星期二) 下午3:18
收件人: "1004483092"<1004483092 at qq.com>;

主题: Re: [PyQt] pyqtdeploy application on windows with math module



As I said, if you don’t have the skills to build and debug C++ code then 
don’t use pyqtdeploy.

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


More information about the PyQt mailing list