r/learnpython • u/TheEyebal • Oct 21 '26
can you get an executable in python without using third part libraries?
In c++ I have object files but can I get an executable in python?
0
Upvotes
r/learnpython • u/TheEyebal • Oct 21 '26
In c++ I have object files but can I get an executable in python?
2
u/PhilNEvo Oct 21 '26
Out of curiosity, why?
If you just want a quick icon to doubleclick, just make a script with batch or shell or something, that runs your python code.
7
u/jameyiguess Oct 21 '26
No. You can do some hacky stuff with bundling the cpython runtime with your files, but it's not machine code.
6
u/ResidentPomegranate6 Oct 21 '26
python never makes a real exe, the interpreter is the executable. stdlib zipapp bundles a .pyz, but still needs python installed.
6
u/DTux5249 Oct 21 '26
No. Python's an interpreted language.
Unless you get an external library/tool, you don't compile Python.
1
u/acw1668 Oct 21 '26 edited Oct 21 '26
In Linux:
chmod a+x ...Then you can get an executable.
1
u/AmanBabuHemant Oct 21 '26
Pyinstaller and Nuitka are two of populer compiler, you can use them to compile and get different kind of executables.
4
u/DanceHackRock Oct 21 '26
That's not what python is for.
1
u/TheRNGuy Oct 21 '26
Can, do not recommend.
1
u/TheRNGuy Oct 21 '26
Can, do not recommend. Use existing frameworks.
0
u/Confident_Hyena2506 Oct 21 '26
Yes - use pyinstaller. This will just bundle python and all the stuff into your exe on windows. You can do similarly on linux but people would look at you funny if called it an exe.
0
u/oclafloptson Oct 21 '26
If a 3rd party library exists then chances are that whatever that library does can also be done without it. The core library doesn't ship with this as a stock feature, though. You'll have to either build it or use a 3rd party system. Given that you have to ask... No one here is going to have great faith in your ability to do the former.
I don't believe that it's right to answer no to this nor to expect others to hand hold you through something of this level of difficulty. This is one of those topics that you need to put down the python-noob sub and start reading actual academic texts. You've got ground to cover before you get to here
-2
u/AromaticCredit1533 Oct 21 '26
You can install the Shed Skin compiler for Python (https://pypi.org/project/shed-skin/), it can compile your Python codebase into an exe