ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Installing Python on Redhat Enterprise Linux Server RHEL 6 and RHEL 7

Updated on August 22, 2015

Installing Python on RHEL 6 and RHEL 7.

If you are new to Python and UNIX then your first step is to find out, how to install and get started? Now days most of UNIX and Linux operating systems comes with pre-installed python of older version. Before getting started, you need to opt correct version of python. Rest on to your requisite and compatibility with your operating system. If you are installing on Redhat Enterprise Linux, then you need different approach to install python. based on version of Linux (RHEL 6 / RHEL 7).

- Later version of RHEL 6 and RHEL 7 come with preinstalled Python version 2.6.

- RHEL 6 or older version, come with Python 2.4.

If you are intended for advance Python development, then Python 2.7 or Higher versions is required. In case your application development require, particular applications or library then you can apply python packages after installation of python. The Python web site provides a Python Package Index (Known as the cheese shop). You can download that from link http://pypi.python.org/pypi?%3Aaction=index.

Find steps below how to install, Python on RHEL 6 and RHEL 7.

Your selection for OS and Method to install python on Linux servers.

From options below, Which OS an method will you select for python installation.

See results

Which Linux version?


Python on
RHEL 6

"Install additional Instance of python of higher version with existing default python instances."

If you are using RHEL 6 then do not uninstall default Python of older version. Which is required for some of procedures Like yum, rhn_upgrade, PIP installation etc. You can install a separate Python of higher version, with your existing version of older python.

Python on RHEL 7

You can uninstall all pre-installed python occurrences and install a fresh python of later version or you can keep both instances.

In this section you can find detail steps for, How to Installing python on,

- RHEL 6 or older version
- RHEL 7

How to Install on RHEL 6.

1: Download and Install Python.
(Note: Selected Python Version 3.4.3, for examples).

You need to download python from https://www.python.org , extract to create compiler, make and make install. ( you need to replace the version with your current version of python.

Download python,

Uncompress downloaded python,

  • $ tar -xvf python-3.4.3

Go to current python directory. [It will be "python-3.4.3", for python version 3.4.3].

  • $ cd python-3.4.3

Building python.

  • $ ./configure
  • $ make
  • $ make altinstall

2: Set environment PATH for Python.

You need to add python in your current “PATH”. Use below command to set PATH, Replace the version with the version you had selected to install.

  • $export PATH="$PATH:/opt/python3.4.3/bin"

//Note: Replace "/opt/python3.4.3/bin" with the path where you are installing.

3: Setuptools & Pip repository.

You need to upgrade PIP repository. Pip allows for uninstallation of packages, and is actively maintained, unlike easy_install Use command below to upgrade.

  • $pip install --upgrade pip

Ensure successful PIP upgrade by adding some PIP repository. Eg: Twitter or Linkedin.

  • $pip install twitter
  • $pip install Linkedin

4: Install idle IDE

If you are interested in web development (Django, HTML templates, JavaScript, etc), then you must Install Python, IDE? Use following command to install,

  • $yum install python-tools

Type the following command, start IDLE under Linux?

  • $ idle

5: Verify Installation.

There are couple of ways to verify successful installation of python. You can use bellow commands to verify python installation status.

1: Check installed python version.

  • $python -V

2: Perform basic check: Type python from installed python directory, It will open python terminal. Type 2+2-2*2/2. It should result “2” at next line.

  • $python
    >>2+2-2*2/2
    >>2

Installing Python on Redhat Enterprise Linux Server 7 (RHEL 7).


Option: Uninstall pre-installed Python occurrences and install a fresh newer python Instance.

1: Check incidence of pre-installed Python version.
Use, Command to check python installation and presence.

  • $which python

Check Python version: If multiple python incidence exist then, to check installed python and it's version you need to use sepereate commands for installed python instances of version 2* and version 3*.

  • $python -V

Earlier command will consequence, only about default Python Instance. In case of multiple Python Instances are installed, you need to check by command.

  • $python2 -V
  • $python3 -V

Command “python2 –V” will display version for all installed python instances of version 2* and command “python3 –V” will result all Instances of python version 3*.

2: Uninstall Python Instances.

If existing instances of python are not found you are good to go for installation of fresh python installation. But if existing python occurrence available then you can uninstall by command.

  • $yum remove python

If multiple instances of python are available then you need to uninstall by command,

1: For python instances of version 2*

  • $yum remove python2

2: For python instances of version 3*

  • $yum remove python3

Delete python files and directories,

  • $ find . -name "python*" -exec rm -rf {} \;
  • $ find . -name "pip*" -exec rm -rf {} \;

3: Installing Python.

(Note: Selected Python Version 3.4.3, for example).

You need to download python from https://www.python.org , extract to create compiler, make and make install. ( you need to replace the version the version you had selected).

Download python,

Uncompress downloaded python

  • $ tar -xvf python-3.4.3

Go to current python directory. [It will be "python-3.4.3", for python version 3.4.3].

  • $ cd python-3.4.3

Building python.

  • $ ./configure
  • $ make
  • $ make install

4: Set environment PATH for Python.

You need to add python in your current “PATH”. Use below command to set PATH. Replace the version with version you had selected to install.

  • $export PATH="$PATH:/opt/python3.4.3/bin"

5: Setup tools and PIP repository.

You need to upgrade PIP repository. Pip allows for uninstallation of packages, and is actively maintained, unlike easy_install Use command below to upgrade.

  • $pip install --upgrade pip

Ensure successful PIP upgrade by adding some PIP repository. Eg: Twitter or Linkedin.

  • $pip install twitter
  • $pip install Linkedin

6: Install Idle IDE.

If you are interested in web development (Django, HTML templates, JavaScript, etc), then you must Install Python, IDE? Use following command to install,

  • $yum install python-tools

Type the following command, start IDLE under Linux?

  • $ idle

7: Verify Installation.

You can verify successful installation of python by command mentioned below,

1: Check python version.

  • $python -V

2: Perform basic check: Type python from installed python directory, It will open python terminal. Type 2+2-2*2/2. It should result “2” at next line.

  • $python

>>2+2-2*2/2
>>2

Means your installation is successful. In case of any error, You can refer "Python Installation Issues and Solution on Redhat Linux", for troubleshooting your installation.

http://www.srai01.hubpages.com/hub/Frequently-Asked-Python-Installation-Issue-for-Redhat-Linux-RHEL-67

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)