Because Lambda does not supply a windows runtime you will not be able to run a package compiled for Windows on Lambda.
However, adding onto @Riku_Kobayashi's answer with an example.
You can try this on your local machine and then apply it to any of the automated build systems out there like GitHub Actions or CircleCI.
-
Install Docker Desktop or Rancher Desktop. Reboot if necessary.
-
Review this script install-dependencies.sh and download it to where your python application is. Modify as needed. It will install the dependencies in the container, leaving a
dependencies.zip
in the directory where you run it. -
Build the ZIP by running the container in your project directory with the command:
docker run -v "${PWD}:/var/task" --cpuset-cpus="0,1" --cpus=2 "amazonlinux:2023" /bin/sh -c "/var/task/install-dependencies.sh"