0

我正在制作 Tornado 应用程序(Python 和 Tornado 的新手,所以问题可能很愚蠢),并且我正在使用其他 Python 包,如 lepl、sqlalchemy 等。是否可以编写 Python 脚本 setup.py 来检查所有这些软件包是否已经安装 - 否则安装它们?或者我需要在 bash 中执行此操作?

4

1 回答 1

2

Use setuptools, and only specify these requirements:

from setuptools import setup

setup(
    # ...
    setup_requires=['lepl', 'sqlalchemy', ...],
)

Then use a proper installing tool such as pip, easy_install (comes with setuptools) or buildout to manage installation of those dependencies.

By separating dependency management and installation, you have much better control over what gets installed when.

I can recommend you read the Python Packaging User Guide to learn more about packaging of python code and dependency management.

于 2012-12-02T17:31:56.500 回答