Tuesday 12 May 2015

How to install Pip in Redhat 6

Note: PiP is a python module and library installer.
To install this command in RedHat Linux 6 first of turn on EPEL repo
STEP 1: Download the pip in Linux
======
root@kali: $ wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Step 2: Install it by using rpm command
root@kali $: rpm -ivh epel-release-5-4.noarch.rpm
OR you use a single step on spite of step 2 and step 3
root@kali $: rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Step 3: Now install pip
root@kali: $ yum -y install python-pip
One example of installing python module using pip:
=================================================
root@kali $: pip install netifaces
Note: netifaces is a networking module in python use to check network and ip information
root@kali:python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import netifaces as neti
>>> neti.ifaddresses(‘wlan0′)
{17: [{‘broadcast': ‘ff:ff:ff:ff:ff:ff’, ‘addr': ’70:f3:95:af:ac:81′}], 2: [{‘broadcast': ‘192.168.0.255’, ‘netmask': ‘255.255.255.0’, ‘addr': ‘192.168.0.102’}], 10: [{‘netmask': ‘ffff:ffff:ffff:ffff::’, ‘addr': ‘fe80::72f3:95ff:feaf:ac81%wlan0′}]}
>>> neti.ifaddresses(‘wlan0′)[2][0][‘addr’]
‘192.168.0.102’
>>>
SO to check ip address we can use netifaces in python

Article Source - http://www.rhce.co.in/how-to-install-pip-in-redhat-6/

No comments:

Post a Comment