1062195630 发表于 2021-6-24 09:51:40

python打包

   PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\liu\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 737, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\liu\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 684, in build
    exec(code, spec_namespace)
File "C:\Users\liu\PycharmProjects\pythonProject1\mylove\mainfun.spec", line 21, in <module>
    exe = EXE(pyz,
File "c:\users\liu\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\api.py", line 450, in __init__
    self.__postinit__()
File "c:\users\liu\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
File "c:\users\liu\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\api.py", line 549, in assemble
    icon.CopyIcons(tmpnm, self.icon)
File "c:\users\liu\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\icon.py", line 216, in CopyIcons
    return CopyIcons_FromIco(dstpath, )
File "c:\users\liu\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\icon.py", line 153, in CopyIcons_FromIco
    for i, f in enumerate(icons):
File "c:\users\liu\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\icon.py", line 120, in __init__
    file.seek(e.dwImageOffset, 0)
OSError: Invalid argument


求解决方法

nahongyan1997 发表于 2021-6-24 10:02:10

命令行哪里输入错了,请看实例:
pyinstaller -F ..\\Http_Server主程序.pyw -p..\\core; -i ..\\..\\Resource\\Icon\\desktop.ico

hrpzcf 发表于 2021-6-24 10:04:07

本帖最后由 hrpzcf 于 2021-6-24 10:05 编辑

文件名(py文件名/图标文件名)有特殊字符,或者图标有问题。
先看看文件名是否有特殊字符,有就换个文件名。
再不行就先不使用图标文件试试能不能打包成功,如果成功了就是图标有问题。
页: [1]
查看完整版本: python打包