{"id":181727,"date":"2024-03-06T11:01:00","date_gmt":"2024-03-06T10:01:00","guid":{"rendered":"https:\/\/liora.io\/en\/?p=181727"},"modified":"2026-02-06T08:27:19","modified_gmt":"2026-02-06T07:27:19","slug":"pyinstaller-everything-you-need-to-know-about-this-python-application","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/pyinstaller-everything-you-need-to-know-about-this-python-application","title":{"rendered":"PyInstaller : Everything you need to know about this Python application"},"content":{"rendered":"<p><strong>Distributing a Python application is not a straightforward task in itself, since it requires you to take into account a large number of factors, not least the libraries involved. However, PyInstaller simplifies the process brilliantly.<\/strong><\/p>\t\t\n\t\t<p>If you&#8217;ve ever had the opportunity to develop with a language such as <strong>Go or Rust<\/strong>, you&#8217;ve probably appreciated the ability to produce a single executable binary when compiling. <strong>Distributing such an executable is simple,<\/strong> since there&#8217;s no need to manage resources external to the program during execution: specific components linked to an OS, graphics assets, other software&#8230;<\/p><p>In the vast majority of cases, the person to whom you handed such an executable simply had to run it as is.<\/p><p>When you&#8217;re developing in a language like <strong>Python,<\/strong> the compilation operation isn&#8217;t nearly as straightforward, as the executable will usually require Python to be present on the target machine, will have to be configured according to the host environment (Windows, MacOS, a particular version of Linux&#8230;), will have to integrate access to various external libraries&#8230;<\/p><p>&nbsp;<\/p><p>?Related articles:<\/p><table dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" data-sheets-root=\"1\"><colgroup><col width=\"656\"><\/colgroup><tbody><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Mastering Machine Learning in Python: Data-Driven Success &quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/machine-learning-python-where-to-start\"><a href=\"https:\/\/liora.io\/en\/machine-learning-python-where-to-start\" target=\"_blank\" rel=\"noopener\">Mastering Machine Learning in Python: Data-Driven Success <\/a><\/td><\/tr><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Python Programming for Beginners - Episode 3&quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/python-programming-for-beginners-episode-3\"><a href=\"https:\/\/liora.io\/en\/python-programming-for-beginners-episode-3\" target=\"_blank\" rel=\"noopener\">Python Programming for Beginners &#8211; Episode 3<\/a><\/td><\/tr><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Django: All about the Python web development framework&quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/django-all-about-the-python-web-development-framework\"><a href=\"https:\/\/liora.io\/en\/django-all-about-the-python-web-development-framework\" target=\"_blank\" rel=\"noopener\">Django: All about the Python web development framework<\/a><\/td><\/tr><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;NumPy : the most used Python library in Data Science&quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/numpy-the-python-library-in-data-science\"><a href=\"https:\/\/liora.io\/en\/numpy-the-python-library-in-data-science\" target=\"_blank\" rel=\"noopener\">NumPy : the most used Python library in Data Science<\/a><\/td><\/tr><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;SciPy: All about the Python Machine Learning library&quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/scipy-all-about-the-python-machine-learning-library\"><a href=\"https:\/\/liora.io\/en\/scipy-all-about-the-python-machine-learning-library\" target=\"_blank\" rel=\"noopener\">SciPy: All about the Python Machine Learning library<\/a><\/td><\/tr><\/tbody><\/table>\t\t\n\t\t\t<h3>What is PyInstaller?<\/h3>\t\t\n\t\t<p>Fortunately, Gordon McMillan, a well-known developer in the <strong>Python community,<\/strong> clearly saw a gap in this area. So, in 2000, he tackled the problem of how to distribute a Python script as a completely self-contained executable &#8211; without the need for a Python installation and various dependencies on the target machine. His project was named<strong> PyInstaller.<\/strong><\/p><p>As is often the case in the <strong>Python community,<\/strong> other developers contributed to the project, and along the way, a real service took shape.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/09\/pyinstaller-1.jpg\" title=\"\" alt=\"\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t<figcaption><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Learn how to use PyInstaller<\/a><\/div><\/div>\n\n\t\t\t<h3>What does PyInstaller do?<\/h3>\t\t\n\t\t<p>When you<strong> submit a Python script to PyInstaller<\/strong>, it produces four output elements:<\/p><ul><li>An<strong> application available as a stand-alone executable<\/strong> (an .exe file for Windows, an .app file for MacOS, a file without extension for Linux), which can be run as is on the target machine.<\/li><li>A <strong>dist (distribution) folder containing the aforementioned application<\/strong> and the dependencies required to run it. That&#8217;s the beauty of it: you don&#8217;t have to manage the said dependencies, <strong>PyInstaller<\/strong> takes care of finding them after analyzing your script and then integrating them one by one into the project, just as it takes care of integrating a Python interpreter.<\/li><li>And if you&#8217;ve specified &#8220;onefile&#8221;, only the executable appears in this folder. The person running the application is often unaware that it has been developed in Python.<br>A build folder containing temporary files generated during the application&#8217;s creation and not required for distribution &#8211; mainly for debugging purposes.<\/li><li><strong>A .spec file:<\/strong> this is a default configuration file for the executable, created when PyInstaller is first run on a Python script. Usually, this file needs to be customized: inclusion of certain modules, data files (e.g. images), application-specific icons, etc.<\/li><li><strong>Once this .spec file<\/strong> has been suitably amended, PyInstaller can be relaunched with just this .spec file to produce the desired executable application.<\/li><\/ul>\t\t\n\t\t\t<h3>Why is PyInstaller so popular?<\/h3>\t\t\n\t\t<p>As you might imagine, PyInstaller has been a godsend for Python developers. As it turns out, it&#8217;s easy to implement, even when you&#8217;re using it for the first time. The availability of the &#8220;onefile&#8221; mode has been very positively perceived, as it produces a particularly easy-to-use executable for the user of the application. PyInstaller also has the advantage of being cross-platform: it can produce code for Windows, MacOS, GNU\/Linux, as well as Unix environments such as Solaris or FreeBSD.<\/p>\t\t\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Make an appointment<\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Distributing a Python application is not a straightforward task in itself, since it requires you to take into account a large number of factors, not least the libraries involved. However, PyInstaller simplifies the process brilliantly. If you&#8217;ve ever had the opportunity to develop with a language such as Go or Rust, you&#8217;ve probably appreciated the [&hellip;]<\/p>\n","protected":false},"author":76,"featured_media":181728,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"editor_notices":[],"footnotes":""},"categories":[2434],"class_list":["post-181727","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-dev"],"acf":[],"_links":{"self":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/181727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=181727"}],"version-history":[{"count":1,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/181727\/revisions"}],"predecessor-version":[{"id":206019,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/181727\/revisions\/206019"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/181728"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=181727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=181727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}