{"id":11401,"date":"2021-05-20T21:50:32","date_gmt":"2021-05-20T16:20:32","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=11401"},"modified":"2021-07-10T11:30:47","modified_gmt":"2021-07-10T06:00:47","slug":"default-python-path","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/default-python-path\/","title":{"rendered":"How to Set Default Path for Python in Windows"},"content":{"rendered":"\n<p>If you are a beginner, then this article is for you. As a beginner, you might face problems in setting a proper path for python. In today&#8217;s tutorial, we will learn how to set a default path for python whenever we install python into our system. <\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#Introduction\" >Introduction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#Why_to_set_up_a_path_for_python\" >Why to set up a path for python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#How_to_select_default_path_while_installing_python\" >How to select default path while installing python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#How_to_set_up_a_default_python_path_for_Windows_manually\" >How to set up a default python path for Windows manually?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#Steps_to_follow_in_detail\" >Steps to follow in detail.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#Using_python_from_Command_Prompt\" >Using python from Command Prompt<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#Checking_of_python_path\" >Checking of python path<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#How_to_handle_multiple_paths_in_python\" >How to handle multiple paths in python?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#Method_1_By_defining_the_path_of_the_versions\" >Method 1: By defining the path of the versions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#Method_2_Creating_a_shortcut\" >Method 2: Creating a shortcut<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#Also_Check_Out_Editors_Choice\" >Also, Check Out Editors Choice:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-introduction\"><span class=\"ez-toc-section\" id=\"Introduction\"><\/span>Introduction <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Unlike most operating systems such as Unix, Windows does not include a system-supported installation of Python. To run Python conveniently from a&nbsp;<strong>command prompt<\/strong>, you might consider changing some default <a href=\"https:\/\/www.nylas.com\/blog\/making-use-of-environment-variables-in-python\/#:~:text=Environment%20variables%E2%80%94%20variables%20that%20exist,running%20your%20scripts%20and%20applications\">environment variables<\/a> in Windows. To temporarily set&nbsp;<strong>environment variables<\/strong>, open Command Prompt and use the set command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">C:\\&gt;set PATH=C:\\Program Files\\Python 3.6; %PATH%<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-why-to-set-up-a-path-for-python\"><span class=\"ez-toc-section\" id=\"Why_to_set_up_a_path_for_python\"><\/span>Why to set up a path for python?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you\u2019ve installed Python in Windows using&nbsp;the default installation options, then the path to Python will not be added to the Windows&nbsp;Path&nbsp;variable. The Path&nbsp;variable lists the directories that will be searched for executing when you type a command in the command prompt. By adding the path to the Python executable, you will be able to access python.exe just by typing the python keyword in your command prompt. You will not need to specify the full path to the program.<\/p>\n\n\n\n<p>Let us see what happens if we enter the&nbsp;<strong>python<\/strong>&nbsp;command in the command prompt and the path to that executable is not added&nbsp;to&nbsp;the Path variable:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">C:\\&gt;python 'python' is not recognized as an internal or external command, operable program or batch file.<\/pre>\n\n\n\n<p>As you can see from the above output, the command was not found. Therefore, to run&nbsp;<strong>python.exe<\/strong>, you&nbsp;will need to specify the full path to the executable. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-select-default-path-while-installing-python\"><span class=\"ez-toc-section\" id=\"How_to_select_default_path_while_installing_python\"><\/span>How to select default path while installing python?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There is an easy way to set up the default path during installing the Python. Every python installer comes with an option to add a python path into environmental variables. This will ensure that you can run python from your terminal. To do this &#8211; <\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Get Python Installer from <a href=\"https:\/\/www.python.org\/\">python.org<\/a>.<\/li><li>Get the installer and an installation window will appear.<\/li><li>Press the &#8220;Add Python X.X to your PATH&#8221; option and install the python.<\/li><\/ol>\n\n\n\n<p>This way you can set up a default path without any headache. If you already have python installed and do not want to reinstall it, then move on to the next methods.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-set-up-a-default-python-path-for-windows-manually\"><span class=\"ez-toc-section\" id=\"How_to_set_up_a_default_python_path_for_Windows_manually\"><\/span>How to set up a default python path for Windows manually?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To permanently modify the default&nbsp;<strong>environment variables<\/strong>&nbsp;: My Computer &gt; Properties &gt; Advanced System Settings &gt; Environment Variables &gt; Edit<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-steps-to-follow-in-detail\"><span class=\"ez-toc-section\" id=\"Steps_to_follow_in_detail\"><\/span><strong><span style=\"text-decoration: underline\">Steps to follow in detail.<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Right-click on &#8216;<strong>My Computer&#8217; <\/strong>or<strong> &#8216;This PC<\/strong>.&#8217; :-To navigate to the Windows Environment Variables screen, where you can add\/edit your paths, right-click on the \u2018<strong>This PC<\/strong>\u2018 icon. Then, select \u2018<strong>Properties<\/strong>.\u2019<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/12-1.png\" alt=\"Steps to follow in detail to set path\" class=\"wp-image-11609\" width=\"-181\" height=\"-228\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/12-1.png 404w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/12-1-238x300.png 238w\" sizes=\"(max-width: 404px) 100vw, 404px\" \/><figcaption>This PC &gt; Properties<\/figcaption><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Select &#8216;<strong>Properties&#8217;<\/strong> at the bottom of the Context Menu.: &#8211; After selecting the properties, the settings pop up.<\/li><li>Next, select &#8216;<strong>Advanced system settings.&#8217;<\/strong><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/1-2.png\" alt=\"Advanced system settings\" class=\"wp-image-11610\" width=\"279\" height=\"378\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/1-2.png 406w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/1-2-222x300.png 222w\" sizes=\"(max-width: 279px) 100vw, 279px\" \/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Check <strong>&#8216;Environment Variables..<\/strong>.&#8217; in the Advanced Tab.: After pressing on the advance settings, another window comes up which shows the Environment Variable option.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/2-1.png\" alt=\"Environment Variables\" class=\"wp-image-11612\" width=\"370\" height=\"383\"\/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Under &#8216;System Variables, &#8216; Check on the <strong>New<\/strong> button in the top half of the dialog to make a new\u00a0<em>user<\/em>\u00a0variable.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/3.png\" alt=\"New button in the top half of the dialog to make a new user variable.\" class=\"wp-image-11615\" width=\"462\" height=\"263\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/3.png 679w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/3-300x171.png 300w\" sizes=\"(max-width: 462px) 100vw, 462px\" \/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>A new user dialog box pop ups which contain Variable name and variable value.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/4.png\" alt=\"default path python\" class=\"wp-image-11616\" width=\"545\" height=\"154\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/4.png 745w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/4-300x85.png 300w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><\/figure><\/div>\n\n\n\n<p>Before you type any values, you\u2019ll need to locate the relevant Python paths. The paths that you\u2019ll need to get are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>copy the python path as show in the image below<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/xx.png\" alt=\"Python Scripts path\" class=\"wp-image-11617\" width=\"394\" height=\"339\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/xx.png 754w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/xx-300x259.png 300w\" sizes=\"(max-width: 394px) 100vw, 394px\" \/><\/figure><\/div>\n\n\n\n<p>Now let\u2019s fill the&nbsp;<strong>New User Variable<\/strong>&nbsp;box that you saw earlier:<\/p>\n\n\n\n<p>For the&nbsp;<strong>Variable name<\/strong>, type \u2018<strong>Path<\/strong>.\u2018 For the&nbsp;<strong>Variable value<\/strong>, copy the full Python application path, then use<strong><a href=\"http:\/\/www.pythonpool.com\/python-semicolon\/\" target=\"_blank\" rel=\"noreferrer noopener\">&nbsp;a semicolon<\/a><\/strong>.<\/p>\n\n\n\n<p>Now select <strong>OK<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-using-python-from-command-prompt\"><span class=\"ez-toc-section\" id=\"Using_python_from_Command_Prompt\"><\/span>Using python from Command Prompt<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>Press on the <strong>start<\/strong> menu.<\/li><li>Type <strong>Command Prompt<\/strong> and open it<\/li><li>Type <strong>&#8220;python.&#8221;<\/strong><ol><li>A response from the <a href=\"http:\/\/www.pythonpool.com\/is-python-compiled-interpreted-or-both\/\">python interpreter<\/a> comes, i.e., it will show the python version currently installed in your system else.<\/li><li>You will get an error message that will be written as <strong>&#8220;python is not recognized as an internal or external command.&#8221;<\/strong> This means that there is something wrong with the path variable setting.<\/li><\/ol><\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-checking-of-python-path\"><span class=\"ez-toc-section\" id=\"Checking_of_python_path\"><\/span>Checking of python path<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>Press on the <strong>start<\/strong> menu.<\/li><li>Type <strong>Command Prompt<\/strong> and open it<\/li><li>Type &#8220;python.&#8221;<\/li><li>Now type the following code.<\/li><\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport os\nos.environ&#x5B;'PYTHONPATH']\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\"><strong>OUTPUT:- <\/strong>'C:\\Program Files\\Python 3.6'<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-handle-multiple-paths-in-python\"><span class=\"ez-toc-section\" id=\"How_to_handle_multiple_paths_in_python\"><\/span>How to handle multiple paths in python?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You may have two versions of python installed in windows in your system, let&#8217;s say 2.7 and 3.9. You want to run one of your projects in the python 2.7 version and another project in the 3.9 version. So the problem that lands up here is how you can specify which version you want to use for a specific python project?<\/p>\n\n\n\n<p>So, to check all the versions of python installed in your windows environment , just type <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">py -0p in command prompt<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"623\" height=\"336\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/hh.png\" alt=\"How to handle multiple paths in python?\" class=\"wp-image-11932\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/hh.png 623w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/hh-300x162.png 300w\" sizes=\"(max-width: 623px) 100vw, 623px\" \/><figcaption>how to check all the versions installed in you system<\/figcaption><\/figure><\/div>\n\n\n\n<p>So, today I will show you 2 methods of how to manage multiple python paths in windows?<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-method-1-by-defining-the-path-of-the-versions\"><span class=\"ez-toc-section\" id=\"Method_1_By_defining_the_path_of_the_versions\"><\/span>Method 1: By defining the path of the versions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Whenever you try to run Python in the command prompt, it searches the&nbsp;%PATH% environment variable and checks for an executable file which can either be a batch file (.bat), command file (.exe), or any other executable file (.exe) that matches the name given. Once the correct file is found, it executes the program using that file.&nbsp;Now, if you have two versions of Python installed on your system (Python 2.7 and 3.9), then the path variable will contain the location of both the directories. But, there is a problem. The problem is once Windows finds the first match, it will stop examining any other path.<\/p>\n\n\n\n<p>To overcome this problem, you have to call one or both applications using their path explicitly. For example, as you can see below, I have two versions of Python installed on my system. <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>To execute <strong>python 2.7<\/strong> you must call <strong>C:\\Python27\\python.exe<\/strong><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"930\" height=\"387\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/oo.png\" alt=\"path of the versions\" class=\"wp-image-11936\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/oo.png 930w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/oo-300x125.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/oo-768x320.png 768w\" sizes=\"(max-width: 930px) 100vw, 930px\" \/><figcaption>Executing python 2.7 using path<\/figcaption><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>To execute <strong>python 3.9<\/strong> we had to type<strong> python3.9.exe<\/strong><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"997\" height=\"497\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/aa.png\" alt=\"default path python\" class=\"wp-image-11938\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/aa.png 997w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/aa-300x150.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/aa-768x383.png 768w\" sizes=\"(max-width: 997px) 100vw, 997px\" \/><figcaption>Accessing python 3.9<\/figcaption><\/figure><\/div>\n\n\n\n<p>This method is one of the simplest method for managing multiple paths of python.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-method-2-creating-a-shortcut\"><span class=\"ez-toc-section\" id=\"Method_2_Creating_a_shortcut\"><\/span>Method 2: Creating a shortcut<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you want to avoid using the entire path, create a shortcut for each python.exe&nbsp;file and rename it as python27 and python39.<\/p>\n\n\n\n<p>In order to create the shortcuts, follow the given steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Navigate to the folder containing the Python version you want to create a shortcut for.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"989\" height=\"164\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/dfuhd-1.png\" alt=\"creating shortcuts\" class=\"wp-image-11942\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/dfuhd-1.png 989w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/dfuhd-1-300x50.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/dfuhd-1-768x127.png 768w\" sizes=\"(max-width: 989px) 100vw, 989px\" \/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Right-click and create a shortcut.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"435\" height=\"680\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/dfuhd.png\" alt=\"run as administrator\" class=\"wp-image-11941\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/dfuhd.png 435w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/dfuhd-192x300.png 192w\" sizes=\"(max-width: 435px) 100vw, 435px\" \/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Rename the shortcut.<\/li><\/ul>\n\n\n\n<p>To run a file in <strong>python 2.7<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"332\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/rt-1024x332.png\" alt=\"python 2.7 default path\" class=\"wp-image-11943\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/rt-1024x332.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/rt-300x97.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/rt-768x249.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/rt.png 1098w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-also-check-out-editors-choice\"><span class=\"ez-toc-section\" id=\"Also_Check_Out_Editors_Choice\"><\/span>Also, Check Out Editors Choice:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-yoast-seo-related-links\"><li><a href=\"http:\/\/www.pythonpool.com\/how-to-clear-python-shell\/\">How to Clear Python Shell in the Most Effective Way<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/python-is-not-recognized-as-an-internal-or-external-command\/\">Python is Not Recognized as an Internal or External Command<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/how-to-check-python-version\/\">How to Check Python Version in Various OS<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/python-get-filename-from-path\/\">Apex Ways to Get Filename From Path in Python<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/no-module-named-tensorflow-error-solved\/\">[Solved] No Module Named Tensorflow Error<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>I hope this article helps you in setting a proper path for python in Windows operating system. As a beginner, you might face difficulties, but no worries, keep reading our tutorials on python and being a pro. Drop a comment if you have doubts. We are just one reply away. Till then, keep reading.<\/p>\n\n\n\n<p>Happy Pythoning Geeks!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are a beginner, then this article is for you. As a beginner, you might face problems in setting a proper path for python. &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Set Default Path for Python in Windows\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/#more-11401\" aria-label=\"More on How to Set Default Path for Python in Windows\">Read more<\/a><\/p>\n","protected":false},"author":19,"featured_media":11984,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[296],"tags":[4032,4030,4034,4033,4035,4036,4031],"class_list":["post-11401","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to","tag-change-default-path-python","tag-default-python-path","tag-i-have-two-python-installed-windows-how-to-set-default-path","tag-python-default-file-path","tag-python-default-install-path","tag-what-is-the-default-python-path","tag-windows-default-python-path","infinite-scroll-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v25.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Set Default Path for Python in Windows - Python Pool<\/title>\n<meta name=\"description\" content=\"If you\u2019ve installed Python in Windows using the default installation options, then the path to Python will not be added to the Windows Path variable.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/default-python-path\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Default Path for Python in Windows\" \/>\n<meta property=\"og:description\" content=\"If you are a beginner, then this article is for you. As a beginner, you might face problems in setting a proper path for python. In today&#039;s tutorial, we\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/default-python-path\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-20T16:20:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-10T06:00:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1350\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sagarika Daripa\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sagarika Daripa\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/\"},\"author\":{\"name\":\"Sagarika Daripa\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/092e9c8a9c793bd19f343d0b8a4009fa\"},\"headline\":\"How to Set Default Path for Python in Windows\",\"datePublished\":\"2021-05-20T16:20:32+00:00\",\"dateModified\":\"2021-07-10T06:00:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/\"},\"wordCount\":1170,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg\",\"keywords\":[\"change default path python\",\"default python path\",\"i have two python installed windows how to set default path\",\"python default file path\",\"python default install path\",\"what is the default python path\",\"windows default python path\"],\"articleSection\":[\"How to\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/default-python-path\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/\",\"url\":\"https:\/\/www.pythonpool.com\/default-python-path\/\",\"name\":\"How to Set Default Path for Python in Windows - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg\",\"datePublished\":\"2021-05-20T16:20:32+00:00\",\"dateModified\":\"2021-07-10T06:00:47+00:00\",\"description\":\"If you\u2019ve installed Python in Windows using the default installation options, then the path to Python will not be added to the Windows Path variable.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/default-python-path\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg\",\"width\":1350,\"height\":650,\"caption\":\"default python path\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/default-python-path\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set Default Path for Python in Windows\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/092e9c8a9c793bd19f343d0b8a4009fa\",\"name\":\"Sagarika Daripa\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b5061d7f84b9ce4980a65ef18a50bba2d1ce8f086e0478fe37bf01423050f927?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b5061d7f84b9ce4980a65ef18a50bba2d1ce8f086e0478fe37bf01423050f927?s=96&d=wavatar&r=g\",\"caption\":\"Sagarika Daripa\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Set Default Path for Python in Windows - Python Pool","description":"If you\u2019ve installed Python in Windows using the default installation options, then the path to Python will not be added to the Windows Path variable.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pythonpool.com\/default-python-path\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Default Path for Python in Windows","og_description":"If you are a beginner, then this article is for you. As a beginner, you might face problems in setting a proper path for python. In today's tutorial, we","og_url":"https:\/\/www.pythonpool.com\/default-python-path\/","og_site_name":"Python Pool","article_published_time":"2021-05-20T16:20:32+00:00","article_modified_time":"2021-07-10T06:00:47+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg","type":"image\/jpeg"}],"author":"Sagarika Daripa","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Sagarika Daripa","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonpool.com\/default-python-path\/#article","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/default-python-path\/"},"author":{"name":"Sagarika Daripa","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/092e9c8a9c793bd19f343d0b8a4009fa"},"headline":"How to Set Default Path for Python in Windows","datePublished":"2021-05-20T16:20:32+00:00","dateModified":"2021-07-10T06:00:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/default-python-path\/"},"wordCount":1170,"commentCount":2,"publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/www.pythonpool.com\/default-python-path\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg","keywords":["change default path python","default python path","i have two python installed windows how to set default path","python default file path","python default install path","what is the default python path","windows default python path"],"articleSection":["How to"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonpool.com\/default-python-path\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pythonpool.com\/default-python-path\/","url":"https:\/\/www.pythonpool.com\/default-python-path\/","name":"How to Set Default Path for Python in Windows - Python Pool","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pythonpool.com\/default-python-path\/#primaryimage"},"image":{"@id":"https:\/\/www.pythonpool.com\/default-python-path\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg","datePublished":"2021-05-20T16:20:32+00:00","dateModified":"2021-07-10T06:00:47+00:00","description":"If you\u2019ve installed Python in Windows using the default installation options, then the path to Python will not be added to the Windows Path variable.","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/default-python-path\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonpool.com\/default-python-path\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/default-python-path\/#primaryimage","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/How-to-Set-Default-Path-for-Python-in-Windows.jpg","width":1350,"height":650,"caption":"default python path"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonpool.com\/default-python-path\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"How to Set Default Path for Python in Windows"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonpool.com\/#website","url":"https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/pythonpool","https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/092e9c8a9c793bd19f343d0b8a4009fa","name":"Sagarika Daripa","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b5061d7f84b9ce4980a65ef18a50bba2d1ce8f086e0478fe37bf01423050f927?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b5061d7f84b9ce4980a65ef18a50bba2d1ce8f086e0478fe37bf01423050f927?s=96&d=wavatar&r=g","caption":"Sagarika Daripa"}}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/11401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=11401"}],"version-history":[{"count":40,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/11401\/revisions"}],"predecessor-version":[{"id":14489,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/11401\/revisions\/14489"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/11984"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=11401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=11401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=11401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}