How to build Python project including dependencies?

我只是一个虾纸丫 提交于 2019-12-12 14:44:47

问题


I have a few projects, all containing setup.py and requirements.txt. Is it possible to package a whole project in one single file including all requirements compiled and ready to install?

What I have tried:

python setup.py bdist_wheel

Builds a .whl file and puts it in the dist directory. The wheel does not contain any dependencies.

pip wheel -r requirements.txt -w wheelhouse

Builds wheels for every single requirement and puts it in the wheelhouse directory. Includes nicely compiled code for numpy for example (I know I have to build this on every platform I want it to run later on, that's fine).

Seems I am just missing the last piece of the puzzle.


回答1:


You probably want to take a look at tools like cx_freeze or PyInstaller if you absolutely want one single file containing everything. Pip itself cannot do what you want.



来源:https://stackoverflow.com/questions/37606773/how-to-build-python-project-including-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!