How to pack python libs I'm using so I can dis

2019-02-07 08:57发布

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.

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.

4条回答
你好瞎i
2楼-- · 2019-02-07 09:33

But if you make a deb with the correct dependencies listed the installer will download them for the user. That's the best way, as it's non redundant.

Maybe you could make a tar or zip with your deb and all the third-party deb's and an install script that just install all the debs in the correct order. This way, if the user already has some package it wouldn't be installed again.

查看更多
做个烂人
3楼-- · 2019-02-07 09:38

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
查看更多
Ridiculous、
4楼-- · 2019-02-07 09:59

You could try freeze.py, see http://wiki.python.org/moin/Freeze for more details.

查看更多
姐就是有狂的资本
5楼-- · 2019-02-07 10:00
登录 后发表回答