{"id":1075,"date":"2022-08-18T16:23:33","date_gmt":"2022-08-18T14:23:33","guid":{"rendered":"https:\/\/nguenkam.com\/blog\/?p=1075"},"modified":"2022-08-18T16:23:33","modified_gmt":"2022-08-18T14:23:33","slug":"how-to-add-variable-to-the-windows-path","status":"publish","type":"post","link":"https:\/\/nguenkam.com\/blog\/index.php\/2022\/08\/18\/how-to-add-variable-to-the-windows-path\/","title":{"rendered":"How to add variable to the Windows Path ?"},"content":{"rendered":"\n<p>Let\u00b4s suppose, we have installed Python in Windows using\u00a0the default installation options, the path to the Python executable wasn\u2019t\u00a0added to the Windows\u00a0<strong>Path<\/strong>\u00a0<strong>variable<\/strong>.\u00a0<\/p>\n\n\n\n<p><strong>PS:<\/strong> \u00a0<em>The Path\u00a0variable lists the directories that will be searched for executables when you type a command in the command prompt. By adding the path to the Python executable, we will be able to access\u00a0<strong>python.exe<\/strong>\u00a0by typing the\u00a0<strong>python<\/strong>\u00a0keyword (We won\u2019t need to specify the full path to the program).<\/em><\/p>\n\n\n\n<p>Consider what happens if we enter the\u00a0<strong>python<\/strong>\u00a0command in the command prompt and the path to that executable is not added\u00a0to\u00a0the Path variable:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\>python\r\n'python' is not recognized as an internal or external command,\r\noperable program or batch file.<\/code><\/pre>\n\n\n\n<p>As we can see from the output above, the command was not found. To run\u00a0<strong>python.exe<\/strong>, we\u00a0need to specify the full path to the executable:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\>C:\\Python34\\python --version\r\nPython 3.4.3<\/code><\/pre>\n\n\n\n<p>To add\u00a0the path to the\u00a0<strong>python.exe<\/strong>\u00a0file to the Path variable, start the\u00a0<strong>Run<\/strong>\u00a0box and enter<strong>\u00a0sysdm.cpl<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"404\" height=\"208\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-1.png\" alt=\"\" class=\"wp-image-2092\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-1.png 404w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-1-300x154.png 300w\" sizes=\"(max-width: 404px) 100vw, 404px\" \/><\/figure>\n\n\n\n<p>This should open up\u00a0the\u00a0<strong>System Properties<\/strong>\u00a0window. Go to the\u00a0<strong>Advanced<\/strong>\u00a0tab and click the\u00a0<strong>Environment Variables<\/strong>\u00a0button:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"426\" height=\"474\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-2.png\" alt=\"\" class=\"wp-image-2093\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-2.png 426w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-2-270x300.png 270w\" sizes=\"(max-width: 426px) 100vw, 426px\" \/><\/figure>\n\n\n\n<p>In the\u00a0<strong>System variable<\/strong>\u00a0window, find the\u00a0<strong>Path<\/strong>\u00a0variable and click\u00a0<strong>Edit<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"385\" height=\"437\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-3.png\" alt=\"\" class=\"wp-image-2094\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-3.png 385w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-3-264x300.png 264w\" sizes=\"(max-width: 385px) 100vw, 385px\" \/><\/figure>\n\n\n\n<p>Position your cursor at the end of the\u00a0<strong>Variable<\/strong>\u00a0<strong>value<\/strong>\u00a0line and add the path to the\u00a0<strong>python.exe<\/strong>\u00a0file, preceeded with\u00a0the semicolon character (<strong>;<\/strong>). In our example, we have added\u00a0the following value:\u00a0<strong>;C:\\Python34<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"356\" height=\"156\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-4.png\" alt=\"\" class=\"wp-image-2095\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-4.png 356w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/08\/image-4-300x131.png 300w\" sizes=\"(max-width: 356px) 100vw, 356px\" \/><\/figure>\n\n\n\n<p>Close all windows. Now you\u00a0can run\u00a0<strong>python.exe<\/strong>\u00a0without specifying the full path to the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:>python --version\r\nPython 3.4.3<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let\u00b4s suppose, we have installed Python in Windows using\u00a0the default installation options, the path to the Python executable wasn\u2019t\u00a0added to the Windows\u00a0Path\u00a0variable.\u00a0 PS: \u00a0The Path\u00a0variable lists the directories that will be searched for executables when you type a command in the command prompt. By adding the path to the Python executable, we will be able [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2092,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[137,140,138,96],"_links":{"self":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1075"}],"collection":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1075"}],"version-history":[{"count":2,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1075\/revisions"}],"predecessor-version":[{"id":2096,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1075\/revisions\/2096"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/2092"}],"wp:attachment":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}