need help to compile python with pyinstaller

☆樱花仙子☆ 提交于 2019-12-02 00:37:11

I think I have a better solution for you: Use nsis in conjunction with pyinstaller.

Here the answers in more detail:

  1. The file is that big because it contains the full python environment. I don't think there's much you can do about it, except creating a virtual environment that contains less files and using less packages in your code.
  2. Running the exe takes a long time because you have chosen the --onefile option. As a result it will unzip the exe, save it to a temporarary directory, and then run the script. When using --onefile it's actually not really an executable, but just a zip file that unzips and then starts itself. A better option might be:
  3. (and 4.). Instead of using the --onefile option, just package it normally with pyinstaller, and then create a script on top of it with nsis. That way the user can run the installer, which will have packaged all the files you put in the nsis script (including all the files created by pyinstaller) and also any additional files you would like. There will be a nice setup interface that will also create a shortcut to the .exe.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!