首页 \ 问答 \ 用于两个或更多python文件(模块)的Python cx_Freeze(Python cx_Freeze for two or more python files (modules))

用于两个或更多python文件(模块)的Python cx_Freeze(Python cx_Freeze for two or more python files (modules))

有一个示例使用一个py文件(模块)构建可执行文件, 这里给出我有大约4个py文件(模块),我想构建可执行文件,其中应包含所有py文件。

当我们有多个python模块时,如何构建python可执行文件?

这里的例子

    from cx_Freeze import setup, Executable

setup(
        name = "hello",
        version = "0.1",
        description = "the typical 'Hello, world!' script",
        executables = [Executable("hello.py")])

如果我有两个文件,如hello1.py和hello2.py,这有hello.py吗?

谢谢


There are example to build executable using one py file(module) as given here I have about 4 py files(modules), I would like to build executable which should include all the py files.

How to build python executable when we have more then one python modules ?

Example from here

    from cx_Freeze import setup, Executable

setup(
        name = "hello",
        version = "0.1",
        description = "the typical 'Hello, world!' script",
        executables = [Executable("hello.py")])

This has hello.py if I have two files like hello1.py and hello2.py ?

Thanks


原文:https://stackoverflow.com/questions/35172483
更新时间:2022-03-01 12:03

最满意答案

除了Callable<Double>之外, Bindings.createDoubleBinding方法还包含一个表示绑定依赖关系的Observable变量。 只有在列出的某个依赖项发生更改时,才会更新绑定。 由于您未指定任何内容,因此绑定在创建后永远不会更新。

要解决您的问题,请使用:

result.bind(Bindings.createDoubleBinding(
    () -> Math.pow(factor.get(), val1.get()),
    val1, 
    factor));

The Bindings.createDoubleBinding method takes, in addition to its Callable<Double>, a vararg of Observable representing the dependencies of the binding. The binding only gets updated when one of the listed dependencies is altered. Since you did not specify any, the binding never gets updated after being created.

To correct your issue, use:

result.bind(Bindings.createDoubleBinding(
    () -> Math.pow(factor.get(), val1.get()),
    val1, 
    factor));

相关问答

更多
  • 为了避免投射,这应该工作: longestLeg = Math.max(distance, longestLeg); 如果您收到有关要求int的错误,则可能意味着您的参数之一是不应该的int。 如果没有确切地看到你是如何调用它就无法确定,但我怀疑它可能与事实有关,当它实际上是一个double时,getLongestLeg()将longestLeg作为int返回。 我建议将该方法更改为: //Returns longest leg of the robot's travels public double g ...
  • 物质 如果你使用CLISP ,你会得到 (defun pentagonal-side (number) (/ (+ 1 (sqrt (+ 1 (* 24 number)))) 6)) (pentagonal-side 51) ==> 6 (pentagonal-side 1533) ==> 32.135838 (pentagonal-side 1533776805) ==> 31977 这是因为ANSI CL允许sqrt返回有效性,而CLISP则允许。 因此你可以使用integerp : (integ ...
  • 您需要修改费用类,以便它可以订阅其他费用类的propertyChanged事件,这样您就可以将租赁者保险连接到租赁类,并在看到rent.value更改时让它更新自己的值。 我相信这条线应该有效。 您可以将它添加到构造函数的底部。 rent.PropertyChanged += (sender, args) => { if (args.PropertyName == "Value") renterInsurance.Value = ((Expense)sender).Value * 0.1; }; ...
  • 如果你只需要一个功能: function doSomething(val) { var result = val *.5 + 50; if ( result > 200 ) { result = 150; } return result; } 在一行中,我认为它将是: var result = (val*.5) + 50 > 200 ? 150 : (val*.5) + 50; If you just need a function: function doSomethi ...
  • 您正在设置onClick 。 相反,它应该是onclick 。 此外,您正在计算parseFloat为"10.00" ,这只是10 。 最后,你试图解析width和height的元素 ; 你需要获得元素的.value 。 Untitled Document