How to set pre-requisites with setup.py

I have a clean python package that relies on 3 other python packages: I use distutils.core.setup to install.

This is my code from setup.py:

from distutils.core import setup

setup(
    name='mypackage',
    version='0.2',
    scripts=['myscript'],
    packages=['mypackage'],
    install_requires=[
        'netifaces > 0.5',
        'IPy > 0.75',
        'yaml > 3.10'])

I have indicated the modules I need with install_requires, but it seems to have no effect on startup

python ./setup.py install

How can I guarantee that the modules mypackage depends on are installed?

+3
source share
1 answer

distutilsIt does not have functions for downloading or even checking the necessary conditions; it install_requiresis available only for documentation.

If you want this, you need a third-party library setuptools.

setuptools , , pip, ( , PyPI), setuptools, setuptools, .

+1

All Articles