Skip to main content
The 2024 Developer Survey results are live! See the results

Timeline for How to compile a python file?

Current License: CC BY-SA 3.0

4 events
when toggle format what by license comment
Jun 11, 2019 at 14:08 comment added spectras @yellow01 you are right that the interpreter will need reading permissions once started through the process MestreLion describes. However, chmod +x grants execute, and does not touch existing permissions so presumably it's readable in addition to now being executable.
Aug 11, 2018 at 13:49 comment added MestreLion @yellow01: when you execute a script that contains a "shebang", ie, first line starts with #!/path/to/interpreter, the kernel actually executes whatever is declared there, passing the script path as an argument. In my example, when you run ./hello.py what is actually executed is /usr/bin/env python ./hello.py. See en.wikipedia.org/wiki/Shebang_(Unix)
Aug 10, 2018 at 17:27 comment added fabda01 I'm confused as to why this works. Doesn't the Python interpreter needs to be able to read the script in order to run it? If you give only execute permission (chmod +x), how is the interpreter reading the script?
Jul 27, 2013 at 1:06 history answered MestreLion CC BY-SA 3.0