如何将导入的库添加到 setup.py

How to add imported libraries into setup.py

我有一个项目,其中我使用 pip install <library> 导入了不同的 python 库,我知道我可以为此创建 setup.py,但我无法完全弄清楚。所以我必须在包中添加所有导入的库?例如packages=['requests', 're']

如果用户没有,我可以用它来安装 python 吗? 或者我只是将我定义的 python 文件添加到包中?例如test1.py、test2.py 编辑

from setuptools import setup

setup(name='Testproject',
      version='0.1',
      description='testing',
      author='tester',
      packages=['requests', 'subprocess'],
      zip_safe=False)

使用 install_requires 来获取依赖项:

http://python-packaging-user-guide.readthedocs.org/en/latest/distributing/?highlight=install_requires#install-requires

“install_requires” should be used to specify what dependencies a project minimally needs to run. When the project is installed by pip, this is the specification that is used to install its dependencies.