I've developed a little script that searches through a wallpaper database online and download the wallpapers, I want to give this script to another person that isn't exactly good with computers and I'm kinda starting with python so I don't know how to include the "imports" of the third party modules in my program so it can be 100% portable, Is there something that can help me do this? or I will have to enter and analyse my third party modules and copy&paste the functions that I use?
An easy thing you can do is simply bundle the other modules in with your code. That does not mean that you should copy/paste the functions from the other modules into your code--you should definitely not do that, since you don't know what dependencies you'll be missing. Your directory structure might look like:
/myproject
mycode.py
thirdpartymodule1.py
thirdpartymodule2.py
thirdpartymodule3/
<contents>
The real best way to do this is include a list of dependencies (usually called requirements.txt
) in your Python package that Python's package installer, pip
, could use to automatically download. Since that might be a little too complicated, you could give your friend these instructions, assuming Mac or Linux:
$ curl http://python-distribute.org/distribute_setup.py | python
. This provides you with tools you'll need to install the package manager.$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
. This installs the package manager.requests
, twisted
, and boto
.$ pip install <list of package names>
. In our example, that would look like $ pip install requests twisted boto
.import boto
should then work, since your friend will have the packages installed on their computer.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With