Skip to main content

[Solved] python is not recognized as an internal or external command

 

[Solved] python is not recognized as an internal or external command

The most asked question I have ever encountered in my Python Training career from students is: "How do I solve for python is not recognized as an internal or external command..." error?

If the following error screen sounds familiar, you are not alone:

The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python
+ ~~~
    + CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Well, this is not a python specific issue but something related to the Path Variable.

What do I need to do to fix this issue?

If you quickly want to fix this issue, you need to follow the steps below to add python to your path variable. 

Follow the steps below:

Step 1: Right-click on your search icon beside the windows icon and type "Environment Variables"

Step 2: A System Properties window will open. Click on Environment Variables

Step 3: Select Path and click on "Edit"

Step 4: Click "New" and add the <location of python installation> and <Python location>/Scripts one by one. 

Windows will now add the Python installation and <python installation>/scripts to the path.

(My python is installed at "C:\Users\iitia\AppData\Local\Programs\Python\Python38-32" so I pasted the following paths one by one after clicking new as shown below!)

Step 5: Well, this step is crucial as it is easy for beginners to skip this one. Make sure (I repeat, make sure) you restart your terminal.

Now try to type python in the terminal, and you should see a screen similar to the one below:

and you are done!

The error is gone. Happy Coding!

Comments

Popular posts from this blog

Connect and Configure MongoDB in Django Project

  Django, a high-level Python web framework, is well-known for its robustness and versatility. While Django natively supports popular databases like PostgreSQL and MySQL, you may want to integrate a NoSQL database like MongoDB for specific use cases. MongoDB’s flexibility and scalability make it an excellent choice for handling unstructured data. In this blog, we will walk you through the process of connecting MongoDB to a Django project, enabling you to harness the power of NoSQL in your web applications. Prerequisites: Before we begin, ensure you have the following prerequisites in place: Django installed on your system. MongoDB database server installed and running. Basic familiarity with Django project structure and database concepts. Virtual Environment, this is optional but recommended. You check our blog  here . Note:  For this tutorial, we are using our basic  skeleton project  for Django. You can also download the project from  here . Step 1: Insta...

How to host Django Application in AWS using gunicorn & nginx in Production

in this post, we will see how to use    nginx  with    gunicorn  to serve    django     applications  in production.  Django is a very powerful web framework and ships with a server which is able to facilitate development. This development server is not scalable and is not suited for production. Hence we need to configure gunicorn to get better scalability and nginx can be used as a reverse proxy and as a web server to serve static files. Let's get started  Step 1 - Installing python and nginx Let's update the server's package index using the command below: sudo apt update Copy sudo apt install python3-pip python3-dev nginx Copy This will install python, pip and nginx server Step 2 - Creating a python virtual environment  sudo pip3 install virtualenv Copy This will install a virtual environment package in python. Let's create a project directory to host our Django application and create a virtual environment inside th...

Mongodb-CheatSheet

  All MongoDb commands you will ever need (MongoDb Cheatsheet) In this post, we will see a comprehensive list of all the    MongoDB  commands you will ever need as a MongoDB beginner. This list covers almost all the most used commands in MongoDB. I will assume that you are working inside a collection named 'comments' on a MongoDB    database  of your choice 1. Database Commands View all databases show dbs Copy Create a new or switch databases  use dbName Copy View current Database db Copy Delete Database  db . dropDatabase ( ) Copy 2. Collection Commands Show Collections show collections Copy Create a collection named 'comments' db . createCollection ( 'comments' ) Copy Drop a collection named 'comments' db . comments . drop ( ) Copy 3. Row(Document) Commands Show all Rows in a Collection  db . comments . find ( ) Copy Show all Rows in a Collection (Prettified) db . comments . find ( ) . pretty ( ) Copy Find the first row matching the ob...