How to Create .exe Executable Files from Python Apps and Games using the PyInstaller Module!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on you guys welcome back to the channel and today i'm going to show you how to turn your python apps and games into executable files using the pi installer module [Music] okay so for this tutorial i'm going to assume you have a project that uh you're happy with the code on you've got your graphical user interface to a place that you're ready to export and you want to turn it into an executable file that you could send people to play and to do that we're going to use the pi installer module and i'm going to be using this doodle jump program that i made in a tutorial on the channel so if you want a project you can go ahead and follow along with this one i'll leave a card to it somewhere above this video but let's assume you already have a project and you just want to export it that's great so hopefully you're using a pretty solid ide but you can do this in any format you want you can actually do it without an ide but if you open up the terminal and the reason i do it down here is because my ide which is pycharm is is really useful if you just hit terminal it opens up what would be like a command prompt so you can get to the same thing just by running a command prompt and then you just need to make sure you enter the file path to your project so in my case it's pycharm projects and then doodle jump but you need to have the install uh you need to have pi installer installed in your project so you want to run pip pi installer just like that and let it run it might take a minute um nope i missed the word install pip install pi installer um and then it's going to run this and it'll say requirement already satisfied if you actually already have this installed if you don't then it's going to go ahead and run it for you the next thing to do once you have it installed you go back to your terminal and all you do is you say pi installer and then as long as you're in the correct correct directory which i am it's this doodle jump directory you do pi installer and then you just type in the name of the file it's looking for main dot pi and then the only other attachment you really have to add um is dash dash one file like that and this should export it but one that's nice to have is also space dash dash and then windowed and that's going to if you do have an error this is just going to keep it open and give you feedback about what error occurred so just run that and it's going to go through and it's going to zip some things up it's going to compile some stuff and then what you'll see okay so once you've run pi installer main dot pi one file windowed in your terminal and i may have said earlier the console window but it should be the terminal or command prompt but i'll zoom in on this just so you can see it a little better it's pi installer main dot pi dash dash one file dash dash windowed it's gonna add a bunch of content to your directory but if you open this in the explorer there's actually only one file you need and it's inside this dist folder and it's going to have the same name and if you didn't give your you can assign it another icon if you really want but it's kind of the same name as the python file you just had it convert to executable and if you double click this you're going to get an error unless you move it out of the directory here if you used any image or any text file or anything that's not directly stored in that game so in in this case you can see um the file doodle.png is not found in the working directory because we tell the program that it's going to be in the same folder so we give it an address for everything all you have to do is just copy it and put it basically right next to whatever dot pi file you converted it from so then if you double click and run it okay it's gonna look just like it's gonna basically look just like when you run it from the console window but what's cool is as you can just send this executable file along with whatever images you use so that's why you need to package everything like add-in images that are required for the game you need to package those all into a folder to send like the whole thing as a playable game um but that's how you create an executable and you could uh put a link to that on like the desktop so um that's one let me go ahead and run it um that's one that i did earlier i put a shortcut to the like flappy bird knockoff game that we made also on the channel but so this is just an executable i don't have to open up pycharm and open my project every time and that's it that's the basics of how you convert any python program or app to an executable using the pi installer module if you have any questions on what you saw in this video or want to see something specific in a future video be sure to let me know in the comments below and feel free to leave a like on the video subscribe to the channel good luck with your code and thanks for watching thanks bye
Info
Channel: LeMaster Tech
Views: 40,807
Rating: undefined out of 5
Keywords: python, executable, python tutorial, beginner code lesson, python lesson, convert python to executable, python practice, code practice
Id: wp2pNVUl3lc
Channel Id: undefined
Length: 5min 22sec (322 seconds)
Published: Mon May 02 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.