Reputation: 1009
I have written a script in python that I would like to be able to give to some less tech-savvy friends. However, it relies on PIL and requests to function. How can I include these modules without forcing my friends to try to install them?
Upvotes: 2
Views: 130
Reputation: 805
Take a look at PyInstaller - http://www.pyinstaller.org/
This allows for the creation of a simple installer which incorporates all required packages.
PIL is listed as a supported package - http://www.pyinstaller.org/wiki/SupportedPackages
Upvotes: 2
Reputation: 3378
It's simple. Make them to put your script in site-packages or dist-packages
. They can import the script using import module
and use them.
Upvotes: -1
Reputation: 172239
They have to install them one way or another, but there are various ways of doing so. Which one depends on how they install your script.
If they install your script with distribute, you can simply add PIL (or better Pillow) as an install dependency.
If they install your script with an installer (exe or msi) then include PIL in that installer.
If they install your script by just copying it somewhere, then your script will have to check if PIL is installed, and if not, install it, as the first thing it does before it tries to import it.
Upvotes: 2