Creating a Stand Alone Executable from a Python Script using PyInstaller

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ธ.ค. 2024

ความคิดเห็น • 196

  • @ProgrammingKnowledge
    @ProgrammingKnowledge  5 ปีที่แล้ว +7

    Full Python Programming Course. th-cam.com/video/bZ6NL59FMoc/w-d-xo.html

    • @peterlandyn6821
      @peterlandyn6821 3 ปีที่แล้ว

      i realize I am pretty off topic but does anybody know of a good place to stream newly released tv shows online?

    • @reignben2284
      @reignben2284 3 ปีที่แล้ว

      @Peter Landyn i watch on Flixzone. You can find it on google :)

  • @JuanCarlos611
    @JuanCarlos611 4 ปีที่แล้ว +27

    If you already have pip, jump to 3:45

  • @learningtho582
    @learningtho582 3 ปีที่แล้ว +2

    Oh god you are amazing! I watched 5 other videos and none of them solved my problem. THANK YOU!

  • @xxjaydog71xx
    @xxjaydog71xx 5 ปีที่แล้ว +10

    I REALLLLLY appreciate this. I've been trying figure this out for a while now.

  • @kilthy7832
    @kilthy7832 2 ปีที่แล้ว +3

    Very helpful, concise and presented tutorial. One bit of feedback from me: It would have been very helpful to see your raw python script code. Even though I can tell the script is a simple print script, not knowing if you had any imports or not for this particular example left me with more questions that should have been given how excellent you are at teaching. As always, very thankful for your lessons!

  • @rosjio99
    @rosjio99 4 ปีที่แล้ว +18

    8:48 Can you share the code for your tkinter application? I’d love to see how you applied style to the form.

  • @sergiopalazzi6033
    @sergiopalazzi6033 2 ปีที่แล้ว +1

    Thank you very much: your explanation is REALLY clear. Thanks to your explanation I solved my problem with this issue! Great job!!!!

  • @DanBrill
    @DanBrill 4 ปีที่แล้ว +7

    Thanks! Lots of time on my hands as the world is currently quarantined. I just started learning Python this morning. This was really helpful!

  • @BJCP
    @BJCP 4 ปีที่แล้ว +6

    Tip for opening cmd prompt from windows explorer. Type CMD in the directory path and hit enter. It will open a cmd prompt in side the current working dir.

    • @qureshizaid
      @qureshizaid 3 ปีที่แล้ว +1

      wow. you made my life easier

    • @BJCP
      @BJCP 3 ปีที่แล้ว +1

      @@qureshizaid glad someone found it useful 🙂

  • @landrhykopp9836
    @landrhykopp9836 2 ปีที่แล้ว +1

    Thank you a lot.Excellent tutorial.

  • @whoozy1555
    @whoozy1555 4 ปีที่แล้ว +2

    Man I love your Videos! You can explain everything so perfectly an understandable! You are helping me with every problem! I love your channel

  • @tolkien11
    @tolkien11 4 ปีที่แล้ว +1

    Just what i was looking for. This is awesome. Thanks a lot!

  • @joliver1981
    @joliver1981 5 ปีที่แล้ว +3

    Great tutorial. Always wondered how this could be done. Thanks!

  • @vidatamas6092
    @vidatamas6092 2 ปีที่แล้ว

    Thank u so much this was really helpful for me

  • @MasterHaz
    @MasterHaz 4 ปีที่แล้ว

    Thank you so much! I just made my first ever application with your help, and im so stoked!!!

  • @pfever
    @pfever 5 ปีที่แล้ว +53

    PIP! ..... PIP! .............. PIP! ...... PIP!

  • @akhilap9652
    @akhilap9652 4 ปีที่แล้ว

    Well explained.... Thanks u made it simple

  • @BimmerWon
    @BimmerWon 2 ปีที่แล้ว +1

    Thanks. I’m gonna make some programs now and run them on my work computer to make my job easier and less tedious. Hopefully I won’t get in trouble lmao.

  • @ahmetselimhansahin9643
    @ahmetselimhansahin9643 2 ปีที่แล้ว

    It was really helpful mate , thank you for your great explanations !!!

  • @parvgour5284
    @parvgour5284 3 ปีที่แล้ว +1

    Thanks for sharing...

  • @JoshuaWayt
    @JoshuaWayt 3 ปีที่แล้ว

    This was incredibly helpful thank you!!

  • @wanderingknight10
    @wanderingknight10 3 ปีที่แล้ว

    Thank you..very well explained

  • @MouseGoat
    @MouseGoat 2 ปีที่แล้ว

    Thanks cool this worked so well :D

  • @CBQReview
    @CBQReview 3 ปีที่แล้ว

    Youre a life saver. Thank You!

  • @AbhishekYadavInd
    @AbhishekYadavInd 5 ปีที่แล้ว

    Great Video for Python...useful

  • @FPChris
    @FPChris 3 ปีที่แล้ว

    8:00 What is the filesize? Can the user run it without having to download python or anything else?

  • @alvarocrespo3748
    @alvarocrespo3748 5 ปีที่แล้ว

    Fantastic tool! I love the "Current Command" window! Thanks

  • @gids522
    @gids522 4 ปีที่แล้ว

    Extremely useful, thank you!

  • @marzantasnimoyshi441
    @marzantasnimoyshi441 3 ปีที่แล้ว

    Thank you so much for making this video. really appreciate it!

  • @muokinzangi3067
    @muokinzangi3067 4 ปีที่แล้ว +4

    what if you need your client to install in both windows, linux and macOS. what do you do?

    • @Tovin
      @Tovin 2 ปีที่แล้ว

      PyInstaller will auto-create the executable program for the operating system you are currently on. A workaround for this if you do not have a Mac and PC would be to run python on a virtual machine whenever you need to create an additional package for another OS

  • @AnilKumar-dc6hv
    @AnilKumar-dc6hv 4 ปีที่แล้ว

    great explanation

  • @woofelator
    @woofelator 4 ปีที่แล้ว

    Just the video i needed!

  • @MatthewNew
    @MatthewNew 3 ปีที่แล้ว +2

    I got an error that said "script 'C:\My_File' not found."

  • @nemanjamarkovic9818
    @nemanjamarkovic9818 4 ปีที่แล้ว

    Finaly works, ty so much, u got yourself subscriber and like

  • @gabrielJustGabe
    @gabrielJustGabe 4 ปีที่แล้ว +3

    Hey, Im having a problem here, my executables doesn't compile with the modules imports, what do I do?

    • @tibiboy1226
      @tibiboy1226 4 ปีที่แล้ว

      same problem here...

    • @fuzbalPob
      @fuzbalPob 4 ปีที่แล้ว

      @@tibiboy1226 same here... any idea?

  • @anasmith5659
    @anasmith5659 4 ปีที่แล้ว

    Great tutorial ❤

  • @Tommy_007
    @Tommy_007 2 ปีที่แล้ว

    Very good video! Just one question: What is the pyintaller command when one's python project consists of more than one file (.py files and maybe other kinds of files)?

  • @stepsvideos
    @stepsvideos 4 ปีที่แล้ว

    Excellent. Thank you.

  • @grendbelema
    @grendbelema 5 ปีที่แล้ว

    thanks for sharing, worked for me

  • @ggssspalwal8676
    @ggssspalwal8676 2 ปีที่แล้ว

    very fruitful

  • @lilwalt_music
    @lilwalt_music 2 ปีที่แล้ว

    I have a problem with this technic 9:48, i have a tkinter .py but when i convert this to onefile that i want, it's open a terminal and a message appear 1 milisecond and close the terminal but my real app didn't openned :/

  • @tiagopaivaguimaraes4465
    @tiagopaivaguimaraes4465 4 ปีที่แล้ว

    You are the man, i love you

  • @BimmerWon
    @BimmerWon 2 ปีที่แล้ว +1

    I’m new to python and programming in general so what’s the point of NSIS? Is it for website downloads of the program? Can’t I just email myself the .exe file and run it on another computer?

  • @caleb8002
    @caleb8002 4 ปีที่แล้ว

    Awesome video.

  • @shawnarmstrong3339
    @shawnarmstrong3339 3 ปีที่แล้ว +1

    Are there extra steps involved when creating an executable with a script that interacts with additional files?
    I tried making an executable of your OpenCV Python video 21. The executable doesn't display any of the images.

    • @bpi2070
      @bpi2070 3 ปีที่แล้ว

      Which additional files ? Do you mean for example photos, icons or databases files ... that are in some specific folder and you are using their paths in your code ?

  • @alibekka4231
    @alibekka4231 3 ปีที่แล้ว

    do i have to use the admin version of the command prompt? it is not working on the non admin version

  • @guillermoh.k.2967
    @guillermoh.k.2967 4 ปีที่แล้ว

    Thanks for uploading!

  • @sainagabharat79
    @sainagabharat79 4 ปีที่แล้ว

    Excellent video...
    How to add copyrights information?

  • @FPChris
    @FPChris 3 ปีที่แล้ว

    You can't do a OSX build from the Windows install?

  • @jagatkrishna1543
    @jagatkrishna1543 ปีที่แล้ว

    Thanks 🙏❤

  • @bottonline4544
    @bottonline4544 5 ปีที่แล้ว +2

    Hi, when executing the instruction , i get an error: " Type error : an integer is required (got type type bytes )"
    my instalation is pip 19.3.1 Pyton 3.8 ?? regards

    • @poorpantoufle8347
      @poorpantoufle8347 5 ปีที่แล้ว +2

      Same for me, apparently it's because pyinstaller's last update is for python 3.5. I have installed the last version with "pip install github.com/pyinstaller/pyinstaller/archive/develop.tar.gz" via command prompt and it's working now :)

    • @karldavidson8843
      @karldavidson8843 5 ปีที่แล้ว +1

      @@poorpantoufle8347 Can confirm, this works. I still get some other errors, but I guess they don't matter.

  • @justice2493
    @justice2493 2 ปีที่แล้ว

    thank you for nice tutorial. I have a question. after I run my .exe file and input some data into database, when I exit the program the data I saved is no longer.

    • @Tovin
      @Tovin 2 ปีที่แล้ว

      Make sure you are saving the data into an external database and a python file does not store any information locally after being closed. You can use the --add-data or --add-binary build attribute for this:
      pyinstaller.org/en/stable/spec-files.html#adding-files-to-the-bundle

  • @jxtian8950
    @jxtian8950 3 ปีที่แล้ว

    5:42 When I double click on this file, my console just quickly opens and then closes.

  • @Megaheropap
    @Megaheropap 4 ปีที่แล้ว +1

    Possible on Mac?

  • @swapnilpatil2445
    @swapnilpatil2445 3 ปีที่แล้ว

    Hello, need video on How to reduce exe file size. Thanks for the video.

  • @shanakaj007
    @shanakaj007 5 ปีที่แล้ว

    your video great. thank you for uploading..

  • @Surya9201
    @Surya9201 2 ปีที่แล้ว

    Hi, I built a GUI using QT designer and using python for the backend script and calling this UI file. how we can build an executable file when i have one python and one UI file?

  • @Rockyzach88
    @Rockyzach88 3 ปีที่แล้ว

    What if you have more than one .py file? Do you just make sure to copy it into the 'dist' folder before you do --onefile ?

    • @Tovin
      @Tovin 2 ปีที่แล้ว

      Use --add-data or --add-binary to include multiple files that are not linked modules!
      pyinstaller.org/en/stable/spec-files.html#adding-files-to-the-bundle

  • @Allan_Ralph
    @Allan_Ralph 3 ปีที่แล้ว

    One Doubt ! I have some empty folders which are needed as temporary storage for image processing , how to add it to Pyinstaller ?

  • @dakshgarg775
    @dakshgarg775 4 ปีที่แล้ว

    Awesome

  • @muhammadsultanularafin8846
    @muhammadsultanularafin8846 4 ปีที่แล้ว +2

    Marvelous tutorial! Appreciate it. Like to know one thing, how to include virtual environment folder in pyinstaller?

  • @FPChris
    @FPChris 3 ปีที่แล้ว

    Dist built on Catalina crashes. Runs fine from terminal.

  • @autarroy
    @autarroy 3 ปีที่แล้ว

    hi sir, is it possible to use NSIS directly to convert your application(tkinter)

  • @madhavvenu3529
    @madhavvenu3529 3 ปีที่แล้ว

    can we run the executable file thus created on any windows even without Python ?

  • @programming_hut
    @programming_hut 4 ปีที่แล้ว +1

    how to make linux executable file

  • @RonyEfendy
    @RonyEfendy 4 ปีที่แล้ว +1

    It works but all images and icons do not appear on my app.

  • @modusvivendi9038
    @modusvivendi9038 3 ปีที่แล้ว

    Is it possible to make the exe file to accept few arguments also , if so how, can you share some web links to understand the process?

  • @KarthikKarthik-lg3ye
    @KarthikKarthik-lg3ye 3 ปีที่แล้ว

    In my computer there is problem in pyinstaller like UPX in not available

  • @titholinux4532
    @titholinux4532 3 ปีที่แล้ว

    how about script requirements and dependencies

  • @rahelly84
    @rahelly84 4 ปีที่แล้ว +1

    if i call other Python members from my executable program it wont work, how can i make it work? using Pycharm

  • @deeepzzz
    @deeepzzz 3 ปีที่แล้ว

    Useful information. But I didn't liked the last part (not about you), that we need to use "that" same operating system to create installer.. which is a bad idea actually (I should able to create installer for windows, linux and mac from my windows machine itself)

  • @mukulM2010
    @mukulM2010 4 ปีที่แล้ว

    Hey I'm getting the "File not found" error as I have images and sounds in my python code.
    How do I set the file path of these images in my python code so that the executable works on any other computer?

  • @adityak3578
    @adityak3578 4 ปีที่แล้ว

    Is installable .exe can be copied to another windows...can i sell my python file likewise without the fear of piracy?

  • @KasturiBurman
    @KasturiBurman ปีที่แล้ว

    I have created a python exe using this process, but when I distribute it to others and try to run the exe on another pc the application does not run. It just pops up for a second and closes automatically. Is there a way to solve it?

  • @sarmadalrubaye8251
    @sarmadalrubaye8251 3 ปีที่แล้ว

    Hello,
    first I would like to thank you for this usefull video,
    second I want to put my equestions regarding to this topic "Pyinstaller",
    I have developt a script and this script import many function from other scripts,
    the problems are:
    1- I have to put all dependencies script together with the exe file in the same dist folder to run.
    2- the exe file doesn't run without install Python in the pc that I use it to run the exe file.
    3- if I use any module like PYQT5 in my script I need to installed in the python.
    so I see Pyinstaller generate non standalone exe file.
    what is the suitable method that can I use to generate 100% standalone exe file without need to install any thing else ??

  • @manakwadhwa
    @manakwadhwa 4 ปีที่แล้ว

    My project is having a main.py file and it has 17 dependencies how should i make them into a one file as it is having links inside it to other files ??? I do have a database i.e. a .db file

  • @ivancamilodamian2137
    @ivancamilodamian2137 4 ปีที่แล้ว

    works on a client pc without python installed previouslly?

  • @MrSantoshKm
    @MrSantoshKm 5 ปีที่แล้ว +1

    Hi. I created one tkinter project and converted into .exe with same method, but this file size is 320MB. Is there any way so I can reduce this file size. I am using these libraries into my project: pandas, datetime, tkinter, win32

    • @SukruthJayam
      @SukruthJayam 3 ปีที่แล้ว

      same here, Did u find any solution for that?

  • @dasmaffin1633
    @dasmaffin1633 5 ปีที่แล้ว +1

    Dist is empty for me
    How do I fix this?

  • @parthrangarajan7474
    @parthrangarajan7474 2 ปีที่แล้ว

    I am having some trouble making this work on a Mac. Could you help me out?

  • @fernandohood5542
    @fernandohood5542 4 ปีที่แล้ว

    How come your antivirus does not try to delete the file?

  • @sethsm7
    @sethsm7 3 ปีที่แล้ว

    Is there a way to package files within the .exe??? I would like to include a .png logo file and a .txt settings file and would like to just package them all together instead of 3 separate files. Thanks!

    • @Tovin
      @Tovin 2 ปีที่แล้ว

      Use --add-data or --add-binary depending on your use case and it should package everything together!
      pyinstaller.org/en/stable/spec-files.html#adding-files-to-the-bundle

  • @shashanksharmadon4295
    @shashanksharmadon4295 5 ปีที่แล้ว

    thanks bro........

  • @xXghostninja
    @xXghostninja 5 ปีที่แล้ว +1

    keep getting PyNaCl library needed in order to use voice. It works on my pycharm but not executabel

  • @ikekuian8173
    @ikekuian8173 5 ปีที่แล้ว +1

    cmd writes that "'pyinstaller' is not recognized as an internal or external command,
    operable program or batch file" :-(
    What can I do?

    • @rajeshwaris6663
      @rajeshwaris6663 5 ปีที่แล้ว

      Set env path

    • @youtubeuser.0
      @youtubeuser.0 3 ปีที่แล้ว

      go to CMD and type in ‘pip install pyinstaller’ and it should install

  • @hareknowsnone
    @hareknowsnone 4 ปีที่แล้ว

    My exe is not working on windows 10. What to do? I did everything on windows 7.

  • @AlgoCoder
    @AlgoCoder 5 ปีที่แล้ว

    Hello, in which folder do i add chrome driver ??

  • @ksatriamelayu3799
    @ksatriamelayu3799 4 ปีที่แล้ว

    Can you run the .exe file in other computer?

  • @marionetx1458
    @marionetx1458 5 ปีที่แล้ว +1

    I tried with all of my codes and a simple code [ print("Hello") ], but the window always closes in a split second.

    • @gweebg
      @gweebg 5 ปีที่แล้ว +1

      Add this to your code at the end: exit = input("Press Any Key To Leave.")

    • @marionetx1458
      @marionetx1458 5 ปีที่แล้ว

      ​@@gweebg Thank you. It works with simple code with Python, but it does not work with my code with Kivy. Is this normal?

  • @vigneshnagaraj7137
    @vigneshnagaraj7137 4 ปีที่แล้ว +1

    Time taken is longer when I click the exe. Is it possible to reduce the starting time of executable file

    • @jonathannorris8255
      @jonathannorris8255 4 ปีที่แล้ว +1

      when bundline to single exe (onefile) pyinstaller must create copies of all needed files into temp folder which is why it takes longer.

  • @lifechanger957
    @lifechanger957 4 ปีที่แล้ว

    Sir my python file need to first type conda activate pro to start it so how can i use it please help

  • @sebastianraszczuk4282
    @sebastianraszczuk4282 4 ปีที่แล้ว

    I did this nsis file (just like you, step by step), and then when I try to sent this by e-mail to my friend or when I try to open this on another computer- I have antivirus or smart screen error that "IT IS A VIRUS AND YOU CAN NOT OPEN IT!". What can I do with it? This nsis file or exe works only on my computer and no one elses...

  • @khanalimphdpe172
    @khanalimphdpe172 2 ปีที่แล้ว

    Great video. I created an exe file from python script using PyInstaller. I use Mac. Exe file works in my pc very well. However, whenever, I take this file other computer regardless of Mac or windows, exe file does not work. It is considered as security thread. The other pc does not recognize this exe file as exe file. Any suggestions for me?

    • @autmek
      @autmek ปีที่แล้ว

      don't know if it will work for you but i had to change .py to pyw and the run this command pyinstaller --onefile filename.pyw this made the terminal in the background to not show up and also windows defender was ok with my file.

  • @thealphabetagamma5252
    @thealphabetagamma5252 3 ปีที่แล้ว

    79 INFO: UPX is not available. I get this error after executing the pyinstaller command . Can you please help me with this ?

  • @filosman4291
    @filosman4291 4 ปีที่แล้ว +1

    thanks

  • @Leo-if9xz
    @Leo-if9xz 4 ปีที่แล้ว

    do you know how to make an exe file, who reads pictures file?

  • @ishpreetkaur3332
    @ishpreetkaur3332 3 ปีที่แล้ว

    I am unable to create ubuntu executable. Please tell what command I need to type for ubuntu?

  • @zakirdhoomun8625
    @zakirdhoomun8625 3 ปีที่แล้ว

    Hi. Can't install " pip install pyinstaller". Am having the following message:" Defaulting to user installation because normal site packages is not writeable". Can somebody explain please.

  • @adityaraj4674
    @adityaraj4674 4 ปีที่แล้ว

    I'm getting Errno 2... for every file that i need to load.... please help.. ASAP!!

  • @MrTonka777
    @MrTonka777 4 ปีที่แล้ว

    Windows and Mac OS X specific options
    -c, --console, --nowindowed
    Open a console window for standard i/o (default). On Windows this option will have no effect if the first script is a ‘.pyw’ file.
    -w, --windowed, --noconsole
    Windows and Mac OS X: do not provide a console window for standard i/o. On Mac OS X this also triggers building an OS X .app bundle. On Windows this option will be set if the first script is a ‘.pyw’ file. This option is ignored in *NIX systems.