{"id":6462,"date":"2025-07-11T16:08:22","date_gmt":"2025-07-11T08:08:22","guid":{"rendered":"https:\/\/www.alfredivy.sg\/blogger\/?p=6462"},"modified":"2025-10-18T23:08:03","modified_gmt":"2025-10-18T15:08:03","slug":"creating-a-portable-python-program","status":"publish","type":"post","link":"https:\/\/www.alfredivy.sg\/blogger\/2025\/07\/creating-a-portable-python-program\/","title":{"rendered":"Creating a portable Python program"},"content":{"rendered":"\n<p class=\"has-drop-cap\">Creating a portable Python program or continuing from my adventures of starting to program in Python.  I have pulled a repository that converts Cisco show inventory into Excel.  <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>After tinkering around, I got the program working to extract the inventory from my Cisco config files.  I have added a few interface hardware types, as these originally weren&#8217;t available.<\/p>\n\n\n\n<p>I created an executable before, but the installer requires admin permissions to install some DLLs.  That is not going to work on corporate computers.<\/p>\n\n\n\n<p>It has to be in a portable format, so no installation is required.  This requires the installation of PyInstaller.<\/p>\n\n\n\n<p> <code>pip install pyinstaller<\/code><\/p>\n\n\n\n<p>Thereafter, compile the Python program <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>pyinstaller --onefile your_script_name.py<\/code><\/code><\/pre>\n\n\n\n<p>This will create the Windows executable in the DIST folder.  The next step is to distribute the program without tripping the Antivirus or Email filters.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.alfredivy.sg\/blogger\/2019\/10\/starting-on-python\/\" data-type=\"link\" data-id=\"https:\/\/www.alfredivy.sg\/blogger\/2019\/10\/starting-on-python\/\" target=\"_blank\" rel=\"noreferrer noopener\">Link<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating a portable Python program or continuing from my adventures of starting to program in Python. I have pulled a repository that converts Cisco show inventory into Excel.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[530],"tags":[531],"class_list":["post-6462","post","type-post","status-publish","format-standard","hentry","category-programming","tag-python"],"_links":{"self":[{"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/posts\/6462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/comments?post=6462"}],"version-history":[{"count":4,"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/posts\/6462\/revisions"}],"predecessor-version":[{"id":6517,"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/posts\/6462\/revisions\/6517"}],"wp:attachment":[{"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/media?parent=6462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/categories?post=6462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.alfredivy.sg\/blogger\/wp-json\/wp\/v2\/tags?post=6462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}