Python Installation And Path Setting
First we need to install Python and need to set its Path to write python programs.But people always get confuse about which version of python should i use for development or writing code i.e Python 2.x or Python 3.x.
Python 2.x is a legacy, where as Python 3.x is the present and future of the language.
Its up to you ,which version you want to use.For more detail on this goto https://wiki.python.org/moin/Python2orPython3. On Linux and Mac OS X it is already preinstalled, you have to just open the Terminal Window and type “python” ,it’ll show you which version of python is installed .If Python is not installed in your system ,then for more details about installation or downloading on different system (Windows,Linux/Unix,Mac Os X,Others) please fallow the installation guide given below.
On Linux and Mac OS X it is already preinstalled but if you want to install new version then fallow the step given below.
- Go to https://www.python.org/downloads/ then click on Linux/Unix link,then click on version (only Gzipped source tarball) that you want to install (note: you can select python 2.x or python 3.x ).
- Download Gzipped source tarball and extract files in your Desktop.
- Open terminal then change directory to Desktop by doing cd Desktop then cd Python-2.7 (the folder name that appear in your desktop after extracting eg. Python-2.x or Python-3.x where x is version like 2.6,2.7,3.4,3.5 etc).
- sudo ./configure then hit enter.
- sudo make then hit enter.
- sudo make install then hit enter.
Python is now install in location usr/local/bin and its libraries in usr/local/lib/Pythonx.x ,where x is version of python i.e python2.x or python 3.x.
To check python is properly installed in your system just open terminal window and type python.
Setting Python directory Path for a particular session in Linux/Unix:
type in terminal–> export PATH=”$PATH:/usr/local/bin/python” and hit Enter.
- Go to https://www.python.org/downloads/ then click on windows link,then click on version (only MSI Installer) that you want to install according to your system requirement ,if your system supports 32 bit or 64 bit platform (note: you can select python 2.x or python 3.x for each bit).
- After downloading the MSI file ,double click on it ,it’ll popup python installer window ,just accept the default setting and wait untill the installation is complete.
To verify that you have properly install python just open command prompt terminal and type python and hit enter.
Setting Python directory Path for a particular session in Windows:
type in terminal–> path %path%;C:\Python and hit Enter.
On Mac OS X:
- Go to https://www.python.org/downloads/ then click on Mac OS X link,then click on version that you want to install according to your system requirement ,if your system supports 32 bit or 64 bit platform (note: you can select python 2.x or python 3.x for each bit).
- For more detail on installation on Mac OS X fallow this link given below.
We don’t need to handel python path in Mac,the installer automatically handel it. Just you have to add python directory to your path to start the Python interpreter from any particular directory.