Skip to content

关于Pyinstaller打包后的exe为什么会报错的解决方案【建议调整一部分代码】 #295

@RyanLoil

Description

@RyanLoil

功能描述
建议调整所有os.path.dirname(file)的代码为相对路径

理由
此部分会导致nonebot在pyinstaller打包后的exe中调用如下目录:
C:\Users\[USERNAME]\AppData\Local\Temp\_MEIXXXXXX\
而pyinstaller打包的py文件却在它自己的exe里面,导致[BOTNAME]\plugins等路径无法被找到

实现方案
建议调整所有os.path.dirname(file)的代码为相对路径

另注:
由于plugin写法,需要在pyinstaller生成的[BOTNAME].spec文件中,在hiddenimports里添加所有在插件里的module
还需要将所有的plugins按照开发目录的原始状态拷贝进dist内,一并发布才行

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions