1

I'm developing an application that requires some initial configuration when first deploying(initial params, server adress,...etc). This application is written in a different language than python, but I'm using python because it's the language that's the most commonly pre-installed on linux machines.

I'm thinking of installing the prerequisites at the top of the script like so:

import os
os.system("python setup.py install <package>")
from <package> import <stuff>

But then I'm installing a package on a computer that belongs to a user, only to use it just once. Should I just uninstall it when my script ends? How do I go about this?

1 Answer 1

1

Why not install the python packages from your shell script prior to execution of your program? See this question if you're trying to uninstall these packages afterwards. It looks like if you install with easy_install or pip, you can just use pip uninstall.

Update based on comments: You can also consider deploying your script as a separate application using cx_freeze, py2exe, or some other option (see additional info here: http://docs.python-guide.org/en/latest/shipping/freezing/).

Sign up to request clarification or add additional context in comments.

7 Comments

yes, that seems the best solution but still seems kinda dirty. Is it really the best way to go? Also thanks for including the uninstallation method :p
Another solution is to just ship Python with the prerequisite packages as a stand-alone program. What's better probably depends on the purpose of your program and your end-users.
If your end-users are all Linux based, consider using freeze or some other packaging: docs.python-guide.org/en/latest/shipping/freezing.
How do I ship it as a stand-alone program?
hmmn I could use freeze for linux distribution and py2exe for windows distribution and that would cover everything!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.