DEV Community

loading...

Python Basics (Installation)

vidit1999 profile image Vidit Sarkar ・3 min read

Introduction

Python is an interpreted, high-level, general-purpose programming language. It has variety of use cases. You can use it for automating certain tasks and do a lot more with it. Here we will see how to install python in your computer. By the way, we are going to use Python 3 not Python 2, so wherever I mention python that will mean Python 3, if not explicitly mentioned something else.

Contents

  • How to install Python
  • Other options
  • What I use
  • Hello World program

How to install Python

For Windows users

Check whether you have python in your system or not, by typing python in terminal or command prompt. If you see something like this, then you don't have python installed.

> python
'python' is not recognized as an internal or external command, operable program or batch file.

Head over to Python Official Website and go to the downloads section. Choose the latest stable python 3 version, download the executable file and install it. Do not forget to add python to your path, so that you can use python from terminal.

Alt Text
Make sure that the box, indicated using red arrow sign, is checked.

For Linux users

You should already have python in your system. You can verify it by typing python3 in terminal and then hitting enter. You should see something like this

$ python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

For Mac users

You should have python 2 in your system. To install python 3, you may need to use Homebrew. You can check out Python official site for more information.

Other options

Other popular options include Anaconda, ActiveState Python and more.

What I use

I personally use Anaconda Python. It comes with its own package manager, called conda and it has has lots of packages pre-installed, so you don't have to install them separately. Head over to their download page and download the version suitable for you system.

Check out their official installation guides.

For Windows users

You may need to add Anaconda to your path to use it from terminal. To do that, make sure the box, indicated using red arrow sign, is checked.

Alt Text

After the installation is successful, open a new terminal or command prompt and type python. You should see something like this

> python
Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Hello World program

In the python shell after the >>> sign type print("Hello World") and hit enter. You will see output like this

> python
Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World")
Hello World
>>>

This is your Hello world program in python. Congratulations!

This is my first post!

Discussion (0)

pic
Editor guide