{"id":1734,"date":"2019-05-03T12:18:28","date_gmt":"2019-05-03T20:18:28","guid":{"rendered":"http:\/\/wonghoi.humgar.com\/blog\/?p=1734"},"modified":"2019-05-03T12:18:28","modified_gmt":"2019-05-03T20:18:28","slug":"python-startup-management","status":"publish","type":"post","link":"https:\/\/wonghoi.humgar.com\/blog\/2019\/05\/03\/python-startup-management\/","title":{"rendered":"Python startup management"},"content":{"rendered":"<p>The <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/startup.html\">startup script<\/a> is simply <code class=\"EnlighterJSRAW\" data-enlighter-language=\"matlab\">startup.m<\/code> in whatever folder MATLAB start with.<\/p>\n<p>Now how about Python? For plain Python (anything that you launch in command line, NOT Spyder though), you&#8217;ll need to ADD a new environment variable\u00a0<code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">PYTHONSTARTUP<\/code> to point to your startup script (same drill for Windows and Linux).<\/p>\n<p>For Spyder, it&#8217;s Tools&gt;Preferences&gt;IPython console&gt;Startup&gt;&#8221;Run a file&#8221;:<\/p>\n<p><a href=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2019\/05\/2019-05-02-21_29_16-Spyder-Python-3.7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1735\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2019\/05\/2019-05-02-21_29_16-Spyder-Python-3.7.png\" alt=\"\" width=\"761\" height=\"482\" srcset=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2019\/05\/2019-05-02-21_29_16-Spyder-Python-3.7.png 761w, https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2019\/05\/2019-05-02-21_29_16-Spyder-Python-3.7-300x190.png 300w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/a><\/p>\n<p>but you don&#8217;t need that if you already have new environment variable\u00a0<code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">PYTHONSTARTUP<\/code>\u00a0correctly setup.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1734\" class=\"pvc_stats all  \" data-element-id=\"1734\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The startup script is simply startup.m in whatever folder MATLAB start with. Now how about Python? For plain Python (anything that you launch in command line, NOT Spyder though), you&#8217;ll need to ADD a new environment variable\u00a0PYTHONSTARTUP to point to &hellip; <a href=\"https:\/\/wonghoi.humgar.com\/blog\/2019\/05\/03\/python-startup-management\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1734\" class=\"pvc_stats all  \" data-element-id=\"1734\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[10,6,34],"tags":[],"class_list":["post-1734","post","type-post","status-publish","format-standard","hentry","category-matlab","category-note-to-self","category-python"],"_links":{"self":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/1734","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/comments?post=1734"}],"version-history":[{"count":3,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/1734\/revisions"}],"predecessor-version":[{"id":1740,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/1734\/revisions\/1740"}],"wp:attachment":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/media?parent=1734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/categories?post=1734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/tags?post=1734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}