indygreg / PyOxidizer

A modern Python application packaging and distribution tool
Mozilla Public License 2.0
5.32k stars 227 forks source link

Can PyOxidizer compile any python file into an independent executable? #726

Open yelban opened 8 months ago

yelban commented 8 months ago

Tried for a whole day, read the official documents, and consulted GPT-4, but couldn't find a way to package a specific python script file into an independent executable, Just like what Nuitka does. Can PyOxidizer compile any python file into an independent executable?

` import cv2

def main(): image_path = '.\photo.jpg'

image = cv2.imread(image_path)

if image is None:
    print("not found")
    return

cv2.imshow('Original Image', image)

cv2.waitKey(0)
cv2.destroyAllWindows()

if name == 'main': main()

`

Cellebyte commented 6 months ago

It can create an executable from a python file. My project uses it exactly for that https://github.com/telekom/netplanner