python - Python Creating an installable program using pyinstaller
问题描述
I am trying to use pyinstaller
to create an installer for my python program, which is typically run as follows:
python -m <folder_name>
( I can't run by calling __main.__py
)
Inside <folder_name>
I have __main__.py
, an empty __init__.py
, and various folders containing python code.
I don't see any options in the pyinstaller documentation to support this type of program structure. Are there options for this?
解决方案
A way to tackle this could be to create another python file which is something like this
from <folder_name>.main import main
if __name__ == '__main__':
main()
And then use pyinstaller
on this file.
Also, make sure that you have an __init__.py
in all the folders with python files so that they are treated like packages when performing a relative import.
推荐阅读
- javascript - 如何将 csv 文件中的数据加载到表单字段中?
- ios - 如何修复“无法下标'ClosedRange类型的值
' 在 swift 中具有类型为 'Int' 的索引" - java - 找不到包 oracle-java8-installer
- django - Django Rest Framework:自定义操作的 DRYer 分页
- javascript - 如何读取默认的内联 onclick 属性,使用里面的链接并对其进行处理?
- angular - 错误 TS2339:“可观察”类型上不存在属性“分区”
' - python - 从列表中选择项目时避免中断
- angular - 离子角度错误错误:未捕获(承诺):错误:参数数组必须有参数。错误:参数数组必须有参数
- wix - 如何防止 WiX 安装程序删除安装前存在的空文件夹
- asp.net-mvc-4 - 如何在 mvc4 中创建 URL