练习使用nuitka对python进行打包。
写了一个简单的main.py文件:
import json
import PySimpleGUI as sg
with open('./data/abc.json') as f:
a = json.load(f)
print(a)
sg.popup('ok')
然后就对这个文件打包。但是一直都是失败
上面这个是经常用的命令,出现的结果,就是卡在这里不动了,好像昨天有一次我等了很久,出现了后续:
PS F:\小程序\demo> nuitka --standalone --nofollow-imports main.py
Nuitka-Options:INFO: Used command line options: --standalone --nofollow-imports main.py
Nuitka-Options:WARNING: Following no imports is unlikely to work for standalone mode and should not be specified.
Nuitka:INFO: Starting Python compilation with Nuitka '1.0.4' on Python '3.8' commercial grade 'not installed'.
Nuitka-Plugins:WARNING: Use '--enable-plugin=numpy' for: Numpy may miss DLLs otherwise.
Nuitka-Plugins:INFO: multiprocessing: Injecting pre-module load code for module 'multiprocessing':
Nuitka-Plugins:INFO: multiprocessing: Monkey patching "multiprocessing" load environment.
Nuitka-Plugins:INFO: multiprocessing: Injecting post-module load code for module 'multiprocessing':
Nuitka-Plugins:INFO: multiprocessing: Monkey patching "multiprocessing" for compiled methods.
Nuitka:INFO: Completed Python level compilation and optimization.
Nuitka:INFO: Generating source code for C backend compiler.
Nuitka:INFO: Running data composer tool for optimal constant value handling.
Nuitka:INFO: Running C compilation via Scons.
Nuitka-Scons:INFO: Backend C compiler: gcc (gcc).
Nuitka-Scons:INFO: Backend linking program with 200 files (no progress information available).
(在这里卡了1小时多)
Nuitka-Scons:INFO: Running 'D:\Program Files\Surpport_python\mingw64\bin\gcc.exe -o "F:\小程序\demo\MAIN~1.DIS\main.exe" -fuse-linker-plugin -flto=8 -fpartial-inlining -freorder-functions -Wl,--exclude-all-symbols -Wl,--out-implib,.\import.lib -municode -O3 -s -Wl,--enable-auto-import -Wl,--stack,9863168 -static-libgcc @".\@link_input.txt" -LC:\Users\JC\AppData\Local\Programs\Python\Python38\libs -lm -lpython38' took 3857.55 seconds
lto-wrapper.exe: warning: using serial compilation of 128 LTRANS jobs
lto-wrapper.exe: note: see the '-flto' option documentation for more information
Nuitka-Scons:INFO: Compiled 401 C files using ccache.
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'cache hit': 201
Nuitka:INFO: Keeping build directory 'main.build'.
Nuitka:INFO: Successfully created 'main.dist\main.exe'.
但是它打包出来的似乎不能用.
但是不说能不能用,首先花那么久时间明显不正常。不知道有没有对此有研究的人来指点一下,该怎么处理。
对了,今天我换了个命令,结果是卡在这里: