What is the best way to give people your python program
I want to give my pyt开发者_开发问答hon program to some people, and they will run this in Linux. What is the best way to do this ? Is it better to give them every script - I have 5 of them, or make it into an installer like *.deb
Thank you.
just tar (zip) it and send it off, .deb is debian based distro's only and tedious for just some scripts:
tar -pczf myscript.tar.gz /path/to/dir/with/scripts
for a bonus add a requirements.txt with the required external dependancies if you have external dependancies; this way people can install the requirements easily by running pip install -r requirements.txt
; Example requirements.txt (one rule per required dep):
PIL==1.1.7
django==1.3.0
python-cjson
If you have used virtualenv
and pip
, you can use pip freeze
as described here.
In the installation instructions you tell your friend to use:
pip install -E foo -r foo/pip-requirements.txt
If you know a little of C/C++, you could make a tiny C/C++ program which kinda Glues all your python scripts together and packs the Python interpreter with it making a pretty presentable executable. Google "Embedding python scripts into a C/C++ application" and look for the CPython Api reference in your python docs.
You can make a .deb package with:
fakeroot dpkg-deb --build /yourdirectory
Your directory should have a yourdirectory/DEBIAN/control file as described here, and yourdirectory/usr/share/uniquename for your program's files, and whatever other directories that need to be installed.
精彩评论