I have pure python package that relies on 3 other python packages: I'm using distutils.core.setup to do the installation.

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 specified the modules I need with install_requires, but it seems to have no effect when I run

python ./setup.py install

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

有帮助吗?

解决方案

distutils has no functionality for downloading, or even verifying, prerequisites; its install_requires is only there for documentation.

If you want that, you need the third-party library setuptools.

Most people already have setuptools, and hopefully pip, and will be using them to install your package anyway (assuming you plan to distribute over PyPI), but if you include the setuptools bootstrap, it will take care of installing setuptools if needed to install those dependencies.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top