如何指定由setuptools创建的命令脚本的shebang行 [英] How do you specify the shebang line of a command script created by setuptools
问题描述
我创建了一个程序包,我将在整个公司中分发该程序包,该程序包将替换具有相同名称的旧版bash脚本.它被引用很多地方,因此需要像当前脚本一样执行.在我遇到一些没有将当前版本的Python作为默认Python(也称为CentOS)的服务器之前,这种方法一直奏效.
I have created a package that I will be distributing throughout the company that replaces a legacy bash script with the same name. It is referenced many places so it needs to execute like the current script does. This has worked fine until I encountered some servers that do not have a current version of Python as the default Python (aka CentOS).
是否可以在setup.py中指定在脚本文件顶部创建的shebang行?即我需要#!/opt/bin/python
而不是#!/usr/bin/env python
.
Is there a way to specify in the setup.py what shebang line is created at the top of the script file? i.e. I need #!/opt/bin/python
rather than #!/usr/bin/env python
.
推荐答案
Keith 回答了我的问题. .以/opt/bin/python setup.py install
身份运行setup.py会产生我需要的结果,而无需任何用户干预.
The answer to my question was answered by Keith. Running the setup.py as /opt/bin/python setup.py install
produces the results I need without any user intervention.
这篇关于如何指定由setuptools创建的命令脚本的shebang行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!