问题描述
如何打包python libs我正在使用,所以我可以分发他们与我的应用程序,尽可能少的依赖关系,也不会与我的系统上已经不同的lib /版本冲突。
How to pack python libs I'm using so I can distribute them with my app and have as few dependencies as possible and also not to conflict with different lib/version that is already on my system.
LE:抱歉,我忘了指定。我会在linux上这样做。而且我不是指使我的应用程序像deb / rpm等可安装的文件,但是如何组织我的文件,例如我将使用cherrypy和sqlalchemy我会发送这些与我的应用程序,而不是把用户通过自己安装所有依赖的痛苦。
L.E.: Sorry i forgot to specify. I will be doing this on linux. And I'm not referring in making my app a installable file like deb/rpm, etc but how to organize my files so like for example I'll be using cherrypy and sqlalchemy I'll ship those with my app and not put the user through the pain of installing all the dependencies by himself.
推荐答案
您可以让用户从启动脚本运行系统,该脚本可以提前修复pythonpath以将您的版本放在第一位。例如,如果将CherryPy,SQLAlchemy等放在external子目录中,可以尝试:
You can have your users run the system from a startup script, and that script can fix the pythonpath ahead of time to put your versions first. For example if you put CherryPy, SQLAlchemy, etc. in an "external" subdirectory, you could try:
# startproj.sh
script_path=`dirname $0`
export PYTHONPATH=${script_path}/external;${PYTHONPATH}
exec ${script_path}/projstartup.py
这篇关于如何打包python libs我正在使用,所以我可以分发他们与我的应用程序,尽可能少的依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!