Saturday, 4 February 2017

Python - Article 2 : Installation

Installing Python is really quick and easy. So let's follow a few simple steps to setup our own Python Environment...😊

                         
                        Installing Python in Linux:

-Python comes preinstalled in most of the linux flavours.
-To check if python is installed or not open the terminal and type:
                              $python --version
-If python is installed the version will be shown in ouput as follows:
                              Python 2.7.12
-The latest version of python available is 3.6.0
-To update/install latest version in the terminal type the command:
                              $sudo apt-get install python <version>
where <version> represents the required version number.



                        Installing Python in Windows:
-The installer for Windows can be downloaded from the following link:
                 https://www.python.org/downloads/windows/
-Keeping in mind the architecture of the machine(64 bit or so) required installer must be downloaded
-Then go to the downloaded installer and double click on it and run it.
-Python version 3 also automatically sets the path variable for python. But if you are using Python version 2 then in windows command prompt type the command:
                   path %path%;C:\Python
-This can also be done by GUI as follows:
               My Computer>>Properties>>Advanced System    Settings>>Environment Variables>>New>>Name(Enter anything like python or pythonexe)>>Value(Path to Python e.g.C:\Python\)>>Select: 'Add python.exe to path'>>Finish/Save



                         Installing Python in Mac OS:
-The installer for Mac OS can be downloaded from the following link:
                 https://www.python.org/downloads/mac-osx/
-Keeping in mind the architecture of the machine(64 bit or so) required installer must be downloaded
-Then go to the downloaded installer and double click on it and run it.
-For Mac OS the installer itself takes care to setup the path variable.



                         How to run Python...
-To use interactive Python just type 'python' in the terminal as:
     python@python:~$ python
     Python 2.7.12 (default, Nov 19 2016, 06:48:10)
     [GCC 5.4.0 20160609] on linux2
     Type "help", "copyright", "credits" or "license" for more information.
     >>>

-To run a python script type the command in the terminal:
                               $python <script_name.py>

No comments:

Post a Comment