Shebang for compiled Python code -
! / Usr / bin / python ...
and I can execute my.py file by
chmod a + r my.py / My .p But after bytecode compiled, the script can only be executed by Python and Shebang no longer works.
dragon my.pyc Is there any way to make AAB able to work with Python script?
./ my.pyc
Shebang only Works for text scripts, not binary files Regardless, you binfmt_misc to *. Pyc can be used to execute files directly, as is reported: Linux, you can use binfmt_misc to run executable from PVC code To: imp.get_magic ()] for import imp, sys, string magic = string.join (["\\ x% .2x"% ord (c) c:
") Reg = ': pyc: M ::% s ::% s:'% (magic, sys.executable) open (" / proc / sys / fs / binfmt_misc / register "," wb "). Writing (reg) Once on your Linux system (or, rather, at boot time), and all the PVC files are executable (if the XBit is set)
In Debian, installing binfmt-support package will do this for you. (The emphasis is mine, note that this will apply to all Debian derivatives, including Ubuntu, which also works in Fedora).
Comments
Post a Comment