3

I wish to package a utility that I have created that depends on Pillow, a port of the Python Imaging Library. Is there a way to include Pillow in my own package or to automatically install Pillow upon running the setup script?

Malik Brahimi
  • 16,341
  • 7
  • 39
  • 70

1 Answers1

2

Python 3 mainly uses pip for installing packages. This is based off of setuptools and distribute. You would create the setup.py script with the requirement specified. The easiest way is to create a requirements file using pip. http://codeinthehole.com/writing/using-pip-and-requirementstxt-to-install-from-the-head-of-a-github-branch/

Command Line:

pip freeze > requirements.txt

setup.py

import setuptools
from pip.req import parse_requirements

requirements = [str(ir.req)
                for ir in parse_requirements("requirements.txt", session=uuid.uuid1())
                    if ir.req is not None]
setuptools.setup(..., install_requires=requirements)

If you want to build an executable then the process if fairly similar to the standard setup.py file approach only you use cx_freeze.

justengel
  • 6,132
  • 4
  • 26
  • 42