Hello, Programmers! Many of us have already worked with Python and at some point in time we all have faced this error of “Python is not recognized as an internal or external command”.
Now, this error is shown to us mainly because of two reasons. Either your system don’t have python installed or maybe it is installed but the path of Python is not configured properly.
In this post, we’ll see both the reasons for this error and we’ll try to fix this.
Python is Not Installed
Sometimes we don’t have python installed on our system but when we try to run python from the command line or the Powershell, this throws us an error of Python is not recognized.
Now to overcome this error, open your browser and download the latest version of Python for your PC and install it on your system.
While installing, don’t forget to check the box that says, Add Python to PATH
. This will install and also set the path for you at the same time.
Not open you command prompt or the Powershell and type Python
and this will open the python shell in that command prompt or that Powershell.
If this was the reason for your “Python is not recognized” problem, I guess you got your solution.
Next step is for those who already installed Python on their PC but still, it is not showing it in your command prompt or the Powershell.
Setting the Path of Python
This is one of the reasons why many of us get this error. We install our Python but we forget to set the path of Python and thus it throws us an error.
- To configure the path of Python properly, open you file explorer and navigate to the folder where you’ve installed Python on you PC.
- You’ll find it somewhere in your
Program Files
folder. - Next step is to open the folder and copy its path.
- Now we have the path of Python, we can now click on Start and search for Edit the System Environment Variables.
- Now click on Environment Variables. Now double click on Path.
- Now click on New and their paste you path of Python which you copied earlier.
Now click ok and you are done with the path setup.
You can now try to open command prompt and type python and hit enter. This will show the version of python installed and a python shell will be opened in that command prompt.
If you have found this post helpful, please share it with your friends or colleagues who are looking for some python programming.
And if you have started with Python development and stuck in some kind of problem or bug, you can leave your comment here and we will get back to you soon.