我有一个设置.py像这样的文件(不是在pwd中,不是在Python path中,在某个地方是一个随机文件):
import ext_modules
config = {
'name': 'mesos.executor',
'version': '1.4.1',
'description': 'Mesos native executor driver implementation',
'author': 'Apache Mesos',
'author_email': 'dev@mesos.apache.org',
'url': 'http://pypi.python.org/pypi/mesos.executor',
'namespace_packages': [ 'mesos' ],
'packages': [ 'mesos', 'mesos.executor' ],
'package_dir': { '': 'src' },
'install_requires': [ 'mesos.interface == 1.4.1' ],
'license': 'Apache 2.0',
'keywords': 'mesos',
'classifiers': [ ],
'ext_modules': [ ext_modules.executor_module ]
}
from setuptools import setup
setup(**config)
我想从一个外部(Python)脚本导入config[“install峎requires”]。我正在寻找最简单的方法来实现这一点,因为它打算从其他脚本运行,甚至可能不是Python。在
一个Python的一行代码会很棒。在
在文档中:https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
在您的情况下:
为了避免从python导入任意路径,还需要从一个模块导入一个
另一种方法有点棘手,暂时使
^{pr2}$setuptools.setup
无效:更新:
如果您还想要bypass import的
ext_modules
:相关问题 更多 >
编程相关推荐