Can anyone say how to detect if code is running in an exe created by Nuitka or in a normal python interpreter?
I think I would ideally like an " is_nuitka " flag that would be set to True when compiled and presumably not exist at all when not compiled.
Could then use code like this:
if '__is_nuitka__' in locals() or '__is_nuitka__' in globals():
print('debug info: running in nuitka mode')
Any suggestions? Is there anything like this available? any alternative approaches?
从Nuitka 0.6.2开始,您可以使用以下代码:
is_nuitka = "__compiled__" in globals()
The first idea is to check sys.argv[0] like
if '.exe' in sys.argv[0]:
# compiled
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.