Adding packages to Python “embedded” installation for Windows

前端 未结 2 1721
醉梦人生
醉梦人生 2021-02-13 21:26

From the documentation:

The embedded distribution is a ZIP file containing a minimal Python environment.

Sounds great! The 64-bit

2条回答
  •  甜味超标
    2021-02-13 21:53

    There is a way to extend Python embedded installation. I managed to create Flask-ready package, that I can just unzip on target machine and run code. The trick is to install EXACT same python version (normal full blown python) as your target embedded small python. Not only version but x86, x64 has to match as well.

    Then install modules from pip on normal python, go to NormalPython\Lib\site-packages and copy all new files that appear after installing to EmbeddedPython\Lib finally add Lib to pythonXX._pth inside Embedded python folder.

    It's extremely important to fully test your application in case you miss some package. Also this would not work for packages that also add .exe to Scripts folder. You could still probably copy the exe's to Script folder and add it to path which could do the trick.

提交回复
热议问题