I have a simple python script which reads a text file and do some processing on it. I need to distribute this code. So any one with Ubuntu operating system could run it. I import some modules as follows.
import pandas
import httpbl
from prettytable import from_csv
etc...
My question is how to make these packages installable with my script in any other users machine(Ubuntu).
There are lot of questions asked and I found this as the closest match. But any way I do not have much knowledge on doing this.
-
ubuntu comes with python. just distribute the source code :)Raiyan– Raiyan2013年11月08日 06:13:16 +00:00Commented Nov 8, 2013 at 6:13
-
@Raiyan Yes, Python is there,but other packages have to be installed? E.g.Pandas,prettytable etc.Nilani Algiriyage– Nilani Algiriyage2013年11月08日 06:16:09 +00:00Commented Nov 8, 2013 at 6:16
-
How about making a folder for your work. Put the main python script there. Also copy the libraries into that folder. Than import the libraries in your main file from this new relative location. You can zip/gzip this entire folder and distribute your work.Raiyan– Raiyan2013年11月08日 06:18:16 +00:00Commented Nov 8, 2013 at 6:18
-
Another possibility, put the entire project on github and tell you friends to download from thereRaiyan– Raiyan2013年11月08日 06:18:46 +00:00Commented Nov 8, 2013 at 6:18
1 Answer 1
You should checkout setuptools: http://pythonhosted.org/setuptools/ which can do exactly what you're looking for.
As an example (this is just a script in the same directory called "recat"):
from setuptools import setup
setup(
name = 'recat',
version = '0.1',
packages = [],
author = 'Name',
author_email = 'email',
description = 'Replay log files simply and easily',
license = 'GPLv3',
keywords = 'log replay',
url = 'URL',
scripts = ['recat']
)
You might also consider creating a Ubuntu package out of it. The FPM project can help you with that: https://github.com/jordansissel/fpm