I Started learning Python 3-4 months ago and today I accidently saw a friend use VS 2019 I became curios and searched up the usage for it using python It says Build WEB APPS using python... Can I make .exe apps using VS 2019 using PYTHON by any chance?
CodePudding user response:
Yes you can write your python code as usual and then use pyinstaller and turn it to .exe
Also note that if your python code doesn't have GUI functionality then it will run in the background till you stop it. If the python code uses console to output then don't use the no console option
Pyinstaller Docs - https://pyinstaller.readthedocs.io/en/stable/
Also the web apps
part. Python is good at those with 2 mostly used frameworks:
Flask - https://flask.palletsprojects.com/en/2.0.x/
Django - https://docs.djangoproject.com/en/3.2/
CodePudding user response:
You do not want to do it.
Python is an interpreted programming language which means that the code is being executed just after being read. Simple to debug, able to be changed without even stopping the application.
On the other side, .exe apps are compiled, that means translated to the efficient machine code. When you code in C , the translation is needed to build the executable. As you get the .exe file, you do not understand its contents, so you can no longer change the behaviour of your built application. The native Windows apps are coded in compiled languages, preferably in C# (just-in-time compilation) or C . Their code is understandable only for the machine.
That's great you are learning Python and that you want to see the results of your work in a form of native Windows apps. The truth is just that this language has been created for a different purpose.
As you opened VS 2019, you saw the button "Build web apps". It means that with a little help from Visual Studio you can run a Python server with a framework like Flask and create an interactive web service. Actually, Flask is used for API-s in many well-known projects like Pinterest, Netflix and Uber. When you deploy a service like these, you do not necessarily need an .exe.
Here you go! https://docs.microsoft.com/en-us/visualstudio/python/learn-flask-visual-studio-step-01-project-solution?view=vs-2022