3/28/2023 0 Comments Python to exe![]() ![]() ![]() Then it will automatically open the folder of the exe file that you lunch. To open the auto-py-to-exe use the following command in the command prompt.Īs you can see it opens a graphical interface that is already self-explanatory you just have to select the app.py file and select what you want in the given option and press on convert.py to. To install auto-py-to-exe use the following command in the command prompt.Īuto-py-to-exe (GUI Tool): auto-py-to-exe is also a library that converts Python scripts into executable Windows programs, able to run without requiring a Python installation. Compiling the script using the auto-py-to-exe library: Step 1: python app.py py2exe Step 4:Īfter running the code folder name dist is created in the root folder and in the dist folder, you can find that app.exe is created. Open a command prompt in the same folder where our python script is saved type the following command and press enter. And if your script runs in the console replace windows for the console. In place of app.py, you can add your python file name. You need to create a new file setup.py at the same directory where you have the script. Py2exe: py2exe library is the same as the pyinstaller library. To install Py2exe use the following command in the command prompt. Compiling the script using Py2exe library: Step 1: You can open the app.exe file to see it running like a normal windows application, you can click on the say hello button that shows the message.Ģ. There you can see folder name dist in that you can find the. Open a command prompt in the same folder where our python script is saved and type the following command and press enter.Īfter running the command you can see that more files and folders are created in the root folder. For example, we created a folder name exe_app and saved my python script named app.py in it. Step 2:Ĭreate a folder and save the python script in it. This reduces the need to install dozens or hundreds of packages when deploying an application or when helping students set up their programming environment. Pyinstaller: With PyInstaller, you can bundle your Python application and all of the packages it relies on into a single, compact executable. To install pyinstaller use the following command in the command prompt. We are going to use three python libraries to Compile a python script into an executable file for windows 1.Compiling the script using Pyinstaller library: Step 1: Root.mainloop() How to Compile a python script for windows: Label1 = tk.Label(root, text= 'Hello Programmer!', fg='red', font=('helvetica', 12, 'bold'))Ĭanvas1.create_window(150, 200, window=label1)īutton1 = tk.Button(text='say hello',command=hello, bg='white',fg='black')Ĭanvas1.create_window(150, 150, window=button1) ![]() ![]() exe file first, we need a Python script here we created a simple python script that gives you simple messes when clicking one button.Ĭanvas1 = tk.Canvas(root, width = 299, height = 299, bg='black') 6 How to Compile a python script for Linux:įor compiling the python script into a.Compiling the script using the auto-py-to-exe library: Compiling the script using Py2exe library: 3 1.Compiling the script using Pyinstaller library:.2 How to Compile a python script for windows:. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |