Python programınızı platformlararası olacak şekilde derlemek

Windows’un 64 bit mimarisinde mingw-w64 kullanarak py dosyalarını derlemek için şu yolu izleyebilirsiniz:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import sys

if len(sys.argv) == 2:
    py = sys.argv[1]
    c = py.rstrip('py') + 'c'
    exe = py.rstrip('py') + 'exe'
    os.system(
        f"cython --embed -o {c} {py} &"
        f"gcc -municode -DMS_WIN64 -mthreads "
        f"-Wall -O -IC:\Python37\include "
        f"-LC:\Python37\libs {c} -lpython37 -o {exe}"
    )