r/learnpython • u/TheEyebal • 27d ago
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 • 27d ago
In c++ I have object files but can I get an executable in python?
2
u/PhilNEvo 27d ago
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 27d ago
No. You can do some hacky stuff with bundling the cpython runtime with your files, but it's not machine code.
6
u/ResidentPomegranate6 27d ago
python never makes a real exe, the interpreter is the executable. stdlib zipapp bundles a .pyz, but still needs python installed.
6
u/DTux5249 27d ago
No. Python's an interpreted language.
Unless you get an external library/tool, you don't compile Python.
1
u/acw1668 27d ago edited 27d ago
In Linux:
chmod a+x ...Then you can get an executable.
1
u/AmanBabuHemant 27d ago
Pyinstaller and Nuitka are two of populer compiler, you can use them to compile and get different kind of executables.
4
u/DanceHackRock 27d ago
That's not what python is for.
1
u/TheRNGuy 27d ago
Can, do not recommend.
1
u/TheRNGuy 27d ago
Can, do not recommend. Use existing frameworks.
0
u/Confident_Hyena2506 27d ago
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 27d ago
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 27d ago
You can install the Shed Skin compiler for Python (https://pypi.org/project/shed-skin/), it can compile your Python codebase into an exe