在python中创建makefile

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19329605/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 13:28:18  来源:igfitidea点击:

Creating makefiles in python

pythonpython-2.7python-3.xmakefile

提问by Scooby

I have two python programs. say a.py and b.py. I build an index in a.py and then run b.py which import a.py.

我有两个 python 程序。说 a.py 和 b.py。我在 a.py 中建立一个索引,然后运行 ​​b.py 导入 a.py。

I want to make a python makefile to install the two porgrams such as I go to my makefile and run :

我想制作一个 python makefile 来安装两个 porgrams,比如我去我的 makefile 并运行:

./install - it installs the project in current directory ./a.py - interprets a.py ./b.py - interprets b.py

./install - 它在当前目录中安装项目 ./a.py - 解释 a.py ./b.py - 解释 b.py

Any idea how to make this or pointers where I could find resource for this ?

知道如何制作这个或指示我可以在哪里找到资源吗?

采纳答案by Emmett Butler

To get started with python distutils, you just need to create a setup.pyfile. See the python referencefor the documentation of setup.py, and see a real example here.

要开始使用 python distutils,您只需要创建一个setup.py文件。有关文档,请参阅python 参考setup.py,并在此处查看真实示例

Once you've made a setup.pyfile that is appropriate to your project structure, you can install the project by running python setup.py install. See thisfor additional commands.

一旦您制作了setup.py适合您的项目结构的文件,您就可以通过运行安装项目python setup.py install。见额外的命令。