WHY YOU SHOULD LEARN USING PYTHON ON CMD?
You can use Python on CMD (Command prompt in
windows). Python on CMD works just like it would work in reality. What I mean
to say is, when you are using programs like Sublime Text 3 (which I use), you
can run the code using the shortcut ’CTRL+B’ in sublime text itself. But the
drawback to this is that it can only be used to print something.
For example,
if your program is meant to take input from the user to continue (which I will
teach you soon, SO STAY TUNED!!!!). Using sublime text you can only print the
statements from the code you cannot actually take the input from the user.
So basically, you can only check if your code is
working without any error using sublime text. But using cmd you can actually
check how your code will work in real life. It will take input from the user,
print the statement and execute the code as it is meant to.
So learning to run Python using cmd is highly
recommended.
Not only this, eventually you have to learn to use
Python through cmd because as you get advanced you will be using different
packages and module which do not come pre-installed in Python, you have to
install it separately, and that can be done using cmd.
HOW
TO USE PYTHON ON CMD?
There are two method which you can
use to run Python using cmd, but first go the folder where you have installed Python
(if you haven’t installed Python yet, you can install it here ) and
copy the filepath from the bar on the top.
Method
#1:
1. Press
‘+R’ on the keyboard and
type ‘cmd’ in the dialog box that opens and press Enter.
2. When
cmd opens, type ‘set path’ and paste the filepath you copied and press Enter
The drawback of using this method is that it is
temporary. When you close cmd, the path will be lost.
To make it permanent you can use the next method.
Method
#2:
1. Go
to ‘My Computer’
2. Right-click anywhere on the window
3. Click
on ‘Properties’ form the drop-down menu
4. Click
on ‘advanced system setting’
5. Go
to ‘environment variables’
6. Double-click on ‘Path’ and paste the filepath
you copied before at the end of the ‘variable value’ section
7. Now
go back to the folder where you have installed Python and copy the filepath of
the ‘Scripts’ folder in the python folder
8. Then
add a semi-colon (;) at the end of the ‘variable
value’ section in the ‘path’ window and paste the filepath of the scripts folder
9. Now
you all you have to do to run Python is type ‘python’ in cmd and press Enter and
Python will be loaded.
CONGRATULATIONS !!! Now you know how to run Python in CMD.
0 Comments
Welcome to the comments section, this is where you can contact me personally for any doubts or feedback