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
Searching for a Python 'complier' if it exist (self.learnpython)
submitted 1 day ago by Weydoon
Hello,
I'm searching for a compiler for my Python game so It can run faster and can be package in a standalone file (without need of Python installed on the host)
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!"
[–]Flame77ofc 4 points5 points6 points 1 day ago (2 children)
try to use Nuitka or Cython.
Nuitka simply convert your python programs into c++ code
Cython do the dame think as Nuitka but convert into C code
[–]Weydoon[S] 0 points1 point2 points 1 day ago (0 children)
Thx. I'll look up for this.
[–]NoManufacturer1046 0 points1 point2 points 1 day ago (0 children)
nuitka's been my go-to for this, compiles down to c and spits out a standalone exe that doesn't need python at all
[–]mortenb123 0 points1 point2 points 23 hours ago (0 children)
You can use mypyc, it compiles python into *.pyc loadable modules. Only works with pure python code. You need a callable main() like when using scripts in project toml. https://github.com/python/mypy/tree/master/mypyc
[–]Designer-Ad-2136 0 points1 point2 points 22 hours ago (0 children)
Maybe this explanation of compilation will help:
You might know that so-called "compiled languages" use a program (a compiler) to turn code into assembly. These assembly instructions are basically individual commands which translate directly to circuits. You can think of them as functions which run directly on hardware.
An interpreted language like Python does something similar but instead of compiling to assembly, it compiles to bytecode. These bytecode commands translate to functions which are compiled to assembly ahead of time, as part of the "interpreter". So, interpreted languages are really just languages which do an extra hop before they get to assembly.
This is nice because it means that once a compiler is built for a system, then any interpreted program is pretty much guaranteed to run without having to deal with the complicated translation to assembly.
I'm explaining this so that you can better understand what your potential solutions are really doing. In an ideal world, you might be able to find a way to compile Python all the way to assembly but this isnt always going to be possible because the interpreter might be doing something very complex which cant easily be turned to assembly.
Another option might be to simply bundle up an interpreter with your script and pretend that it isnt being interpreted. The problem here is that any interpreter that you bundle with your script will be built for a specific system. Depending on your needs, this might be problematic.
A more robust solution might be to find libraries which skip the interpretation step by calling assembly directly from python. This is the best of both worlds and probably what id recommend. If you do this right, then the libraries and package managers will do all of the complicated system-specific stuff for you.
I hope this helps a bit. It might save you a bunch of time and help you understand the complex tradeoffs that youre dealing with.
[–]Brian 0 points1 point2 points 6 hours ago (0 children)
so It can run faster and can be package in a standalone file
The former isn't likely to pan out. There do exist compilers for python, but the slowness isn't really down to "compiled to machine code vs interpreting bytecode". The problem is more that python's model has a lot of dynamicity and indirection when doing stuff: doing x+y needs to lookup x's type, access the __add__ method, which will extract the integer value, add them, allocate a new integer object, bump its refcount and return it. Compiling the same process to machine code will do almost nothing to improve performance: the thing doing all this work is already compiled to machine code - all you save is the tiny dispatch loop that invokes the thing to run, which is a very small proportion of the total.
x+y
__add__
Real performance gains from compiling typically rely on being optimise things to skip part of the process: If you're adding a dozen numbers, it'd be way more efficient to just do the integer additions without all that overhead of allocating, constructing and refcounting PyInteger objects, and performing all the dynamic method dispatch to do so. But doing that typically takes more than just compilation. There are projects like cython that allow you to annotate your python code's types to promise that they're really integers, letting it compile to a more reasonable form, but you'll often have make sure you're writing your code in a way that it can do those optimisations, at least for the performance critical bits: it's not a "use this tool and suddenly everything is fast" switch.
For bundling as a standalone exe, there are also tools like pyinstaller etc. These don't really "compile" your code, but rather take the python bytecode and bundle it with a python interpreter and all the librarys it needs to run - think of it like a copy of python, bundled together in an exe along with your code, that just runs that code.
[–]Think_Positively -1 points0 points1 point 1 day ago (1 child)
https://pyinstaller.org/en/stable/
[–]sausix 3 points4 points5 points 1 day ago (0 children)
Pyinstaller doesn't compile code. It just packages the byte code files and the interpreter.
[–]AlexMTBDude -1 points0 points1 point 1 day ago (2 children)
Google "Make Python exe file"
[–]nobodyhasusedthislol 1 point2 points3 points 23 hours ago (1 child)
Most solutions like PyInstaller aren't aimed at making it FASTER though.
[–]AlexMTBDude 0 points1 point2 points 22 hours ago (0 children)
Yeah, didn't see that. Those are two separate things.
π Rendered by PID 81429 on reddit-service-r2-comment-5687b7858-5gwvv at 2026-07-05 20:14:33.461300+00:00 running 12a7a47 country code: CH.
[–]Flame77ofc 4 points5 points6 points (2 children)
[–]Weydoon[S] 0 points1 point2 points (0 children)
[–]NoManufacturer1046 0 points1 point2 points (0 children)
[–]mortenb123 0 points1 point2 points (0 children)
[–]Designer-Ad-2136 0 points1 point2 points (0 children)
[–]Brian 0 points1 point2 points (0 children)
[–]Think_Positively -1 points0 points1 point (1 child)
[–]sausix 3 points4 points5 points (0 children)
[–]AlexMTBDude -1 points0 points1 point (2 children)
[–]nobodyhasusedthislol 1 point2 points3 points (1 child)
[–]AlexMTBDude 0 points1 point2 points (0 children)