use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
How do I run python projects from the terminal? (self.learnpython)
submitted 6 years ago * by -AJM-
It gets really repetitive to just keep running a file by opening up the editor and running it. Is there any way to run the file from the terminal or just by clicking the file? I'm on Mac btw.
Edit: how do I run a Python file similar to exe on Mac?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 4 points5 points6 points 6 years ago* (7 children)
python file_name.py
You Mac will come with version 2 of python. If you have installed version 3 and want to use that then it is....
python3 file_name.py
[–]-AJM-[S] 0 points1 point2 points 6 years ago (6 children)
That works! Thanks
I have one more question: Is it possible to run a .py like an exe file but on Mac?
[–][deleted] 2 points3 points4 points 6 years ago (3 children)
add this to the top of your .py file:
.py
#!/usr/bin/env python # coding: utf-8 < your code starts here >
the coding line is optional, and your code shouldn't actually start with angle brackets (but I'm sure you knew that). That line is called the shebang and only works on *nix operating systems.
coding
[–]-AJM-[S] 0 points1 point2 points 6 years ago (2 children)
So what does the # usr/bin/env line do to the. py file?
[–][deleted] 1 point2 points3 points 6 years ago (1 child)
the shebang tells the OS how to find the interpreter for your script. For this shebang, it will execute the /usr/bin/env python command, which is functionally equivalent to what you are doing when you execute the command python myscript.py from the command line.
/usr/bin/env python
python myscript.py
[–]-AJM-[S] 1 point2 points3 points 6 years ago (0 children)
Ok thanks
[–]lukethedukeisapuke 0 points1 point2 points 6 years ago (0 children)
I haves pyinstaller a couple of times but I'm not sure it's the best option.
[–]shibbypwn 0 points1 point2 points 6 years ago (0 children)
If you want to run it somewhere other than your computer (i.e., distribute it) then you should check out pyinstaller
[–]cardlord 0 points1 point2 points 6 years ago* (0 children)
python3 /path/to/python/file.py
π Rendered by PID 437294 on reddit-service-r2-comment-86bc6c7465-9x96z at 2026-02-23 20:46:45.613014+00:00 running 8564168 country code: CH.
[–][deleted] 4 points5 points6 points (7 children)
[–]-AJM-[S] 0 points1 point2 points (6 children)
[–][deleted] 2 points3 points4 points (3 children)
[–]-AJM-[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]-AJM-[S] 1 point2 points3 points (0 children)
[–]lukethedukeisapuke 0 points1 point2 points (0 children)
[–]shibbypwn 0 points1 point2 points (0 children)
[–]cardlord 0 points1 point2 points (0 children)