Creating a Stand Alone Executable from a Python Script using PyInstaller

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ต.ค. 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!

  • @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 🙂

  • @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!!!!

  • @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

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

    Thank you a lot.Excellent tutorial.

  • @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!

  • @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.

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

    Thank u so much this was really helpful for me

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

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

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

    Well explained.... Thanks u made it simple

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

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

  • @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)?

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

    This was incredibly helpful thank you!!

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

    Thanks cool this worked so well :D

  • @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.

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

    Thank you..very well explained

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

    Youre a life saver. Thank You!

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

    Extremely useful, thank you!

  • @muokinzangi3067
    @muokinzangi3067 3 ปีที่แล้ว +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

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

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

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

    Great Video for Python...useful

  • @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?

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

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

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

    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 ?

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

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

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

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

  • @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 ??

  • @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

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

    Thanks for sharing...

  • @gabrielgoncalvesazevedo9114
    @gabrielgoncalvesazevedo9114 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?

  • @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?

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

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

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

    thanks for sharing, worked for me

  • @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?

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

    Just the video i needed!

  • @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)

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

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

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

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

  • @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?

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

    Excellent. Thank you.

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

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

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

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

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

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

  • @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 ?

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

    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

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

    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 4 ปีที่แล้ว +3

      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 4 ปีที่แล้ว +1

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

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

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

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

    your video great. thank you for uploading..

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

    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.

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

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

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

    You are the man, i love you

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

    Thanks for uploading!

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

    Excellent video...
    How to add copyrights information?

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

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

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

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

  • @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 2 ปีที่แล้ว

      same here, Did u find any solution for that?

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

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

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

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

  • @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

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

    great explanation

  • @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

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

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

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

    I amnot from a computer science background... Can u please how can we make this exe file open in our mobilephone

  • @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

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

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

  • @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?

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

    how about script requirements and dependencies

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

    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...

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

    It won't work if the other computer doesnt have python, because 'Handshaking' does not happen with operating system and interpreter language ,here python . Therefore to make it run on pc without python the code should be compiled , so either the python code should be compiled somehow or the code should be written in compiler language like C

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

    This wont make it safelty closed source / hard to reverse engineer though right? For those of us considering making paid products with python

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

      How we can make it safe?

  • @rohitkr.9307
    @rohitkr.9307 4 ปีที่แล้ว +1

    Sir , i have a simple kivy file i want to execute other py file via kivy and get the output on mobile in kivy gui how can i do
    Actually i want to make an app like qpython, pydroid to run python file via kivy interface
    I searched the whole internet butvi did not get the way to do this
    Please respond me and make a video on it please i will be very thankful to you please.....

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

      I'm not sure I understand your question completely but if you want to create an app on your phone with Kivy you need to use their Buildozer tool and be on a Linux machine.

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

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

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

    works on a client pc without python installed previouslly?

  • @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

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

    Dist built on Catalina crashes. Runs fine from terminal.

  • @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.

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

    Great tutorial ❤

  • @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.

  • @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.

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

    Thank you sir, how do i create a registration form like the one you used to demonstrate this tutorial?

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

      @law it is created using tkinter in python

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

    very fruitful

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

    It does not work. I tried with a simple hello world program. Even though I installed everything as described, starting pyinstaller did not work. Instead I got the error message, that the 'pyinstaller' command was not found. Is there any solution for that?
    Thanks in advance!

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

    While installing pyinstaller it is giving this error.
    Failed to build pyinstaller
    ERROR: Could not build wheels for pyinstaller which use PEP 517 and cannot be installed directly.
    How to resolve it?

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

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

  • @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 :/

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

    hello, i my app got built but i am getting error, fatal error detetcted and failed to open script (my_prog_name)
    any solution to such pls..

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

    Can you run the .exe file in other computer?

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

    What when we scan exe file building by pyintaller we find a lot of malware and trojan

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

    Dist is empty for me
    How do I fix this?

  • @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

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

    how to make linux executable file

  • @a.svasial884
    @a.svasial884 4 ปีที่แล้ว

    fatal error detected failed to execute script pyi_rth_pkgres.... Showing this error when i open my tkinter project.... Plz help me bro

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

    Possible on Mac?