本文介绍了为什么'#!的/ usr /斌/包膜蟒蛇'据说不仅仅是正确的'#!的/ usr / bin中/ Python的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道这一点?我从来没有能够找到答案。

Anyone know this? I've never been able to find an answer.

推荐答案

如果你容易在你的PATH安装在不同的和有趣的地方蟒蛇(如 $ PATH 在典型的Unix外壳,%PATH 典型的Windows的),使用的/ usr / bin中/ env的将容纳您的心血来潮(当然,在类Unix环境中至少),而直接进入的/ usr / bin中/ Python的不会。但失去的是什么版本的Python脚本下运行的控制没有纯粹的讨价还价......如果你看我的code,你就更有可能看到它与启动,例如,#!/ USR / local / bin目录/的python2.5 而不是一个开放并接受#在/ usr /斌/包膜蟒蛇! - 假设脚本重要的是我喜欢以确保它与我所测试的特定版本上运行,并与,而不是一个半随机的开发它; - )

If you're prone to installing python in various and interesting places on your PATH (as in $PATH in typical Unix shells, %PATH on typical Windows ones), using /usr/bin/env will accomodate your whim (well, in Unix-like environments at least) while going directly to /usr/bin/python won't. But losing control of what version of Python your scripts run under is no unalloyed bargain... if you look at my code you're more likely to see it start with, e.g., #!/usr/local/bin/python2.5 rather than with an open and accepting #!/usr/bin/env python -- assuming the script is important I like to ensure it's run with the specific version I have tested and developed it with, NOT a semi-random one;-).

这篇关于为什么'#!的/ usr /斌/包膜蟒蛇'据说不仅仅是正确的'#!的/ usr / bin中/ Python的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 06:15