Pro*_*ica 7 python shell scripting pyc
有没有办法阻止python创建.pyc文件,已经在Python脚本的shebang(或魔法数字)中?
不工作:
#!/usr/bin/env python -B
Run Code Online (Sandbox Code Playgroud)
可以将你的python interperter路径直接放在她的bang而不是使用env.
#!/usr/bin/python -B
Run Code Online (Sandbox Code Playgroud)
当然这意味着你失去了使用env的一些便携性优势.在维基百科Shebang页面上讨论了这个问题.他们使用python作为他们的env示例之一.
是的,当且仅当我们假设 Python 程序在某种程度上 POSIX 兼容的系统(对于 /bin/sh)中运行时,这才有效:
(根据 glglgl 的输入进行了改进)
#!/bin/sh
"exec" "python" "-B" "$0" "$@"
# The rest of the Python program follows below:
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
991 次 |
| 最近记录: |