python setup.py install 更改脚本解释器
我有一个 Python 包,其中包含 scripts/
文件夹中的一些脚本。我的 setup.py 文件包括::
#!/usr/bin/env python
from distutils.core import setup
scripts = ['script1', 'script2', 'script3']
setup(name='Test',
version='0.1.0',
packages=['test'],
scripts=['scripts/' + x for x in scripts]
)
包含行::
#!/usr/bin/env python
每个脚本都在顶部 更改为::
#!/usr/bin/python
。但是,当我运行 python setup.py install 时,此行会在已安装的脚本中自动 。有办法避免这种情况吗?这对我来说是一个问题,因为我使用的是 virtualenv,所以 Python 可执行文件的正确路径应该是::
#/Users/user/.virtualenvs/default/bin/python
所以我宁愿将解释器设置为::
#!/usr/bin/env python
感谢您的任何建议!
I have a Python package that includes a few scripts in a scripts/
folder. My setup.py
file includes::
#!/usr/bin/env python
from distutils.core import setup
scripts = ['script1', 'script2', 'script3']
setup(name='Test',
version='0.1.0',
packages=['test'],
scripts=['scripts/' + x for x in scripts]
)
Each script contains the line::
#!/usr/bin/env python
at the top. However, when I run python setup.py install
this line gets changed to::
#!/usr/bin/python
automatically in the installed scripts. Is there a way to avoid this? The reason that this is a problem for me is because I am using virtualenv, and so the correct path for the Python executable should be::
#/Users/user/.virtualenvs/default/bin/python
so I'd rather it left the interpreter set to::
#!/usr/bin/env python
Thanks for any advice!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
安装脚本会检查 python 的安装位置,并将该 python 更改为正确的 python。它在安装了软件包的每台机器上都会执行此操作。
来自文档:
The install scripts checks, where the python is installed and changes this python to the proper one. It does it on every machine, where your package is installed.
From docs: