Python - Manual Install on a user scope via a RPM package

About

Download and install a python rpm that is available through one of your repository.

Prerequisites

Steps

List the RPM

Two options:

showduplicate

yum --showduplicates list python-2.7.5*
Installed Packages
python.x86_64                                          2.7.5-76.el7                                              @rhui-rhel-7-server-rhui-rpms
Available Packages
python.x86_64                                          2.7.5-16.el7                                              rhui-rhel-7-server-rhui-rpms
python.x86_64                                          2.7.5-18.el7_1.1                                          rhui-rhel-7-server-rhui-rpms
python.x86_64                                          2.7.5-34.el7                                              rhui-rhel-7-server-rhui-rpms
python.x86_64                                          2.7.5-38.el7_2                                            rhui-rhel-7-server-rhui-rpms
python.x86_64                                          2.7.5-39.el7_2                                            rhui-rhel-7-server-rhui-rpms
python.x86_64                                          2.7.5-48.el7                                              rhui-rhel-7-server-rhui-rpms
python.x86_64                                          2.7.5-58.el7                                              rhui-rhel-7-server-rhui-rpms
python.x86_64                                          2.7.5-68.el7                                              rhui-rhel-7-server-rhui-rpms
python.x86_64                                          2.7.5-69.el7_5                                            rhui-rhel-7-server-rhui-rpms
python.x86_64                                          2.7.5-76.el7                                              rhui-rhel-7-server-rhui-rpms

repoquery

  • to install repoquery
sudo yum install yum-utils  
  • query
sudo repoquery --show-duplicates python
python-0:2.7.5-16.el7.x86_64
python-0:2.7.5-18.el7_1.1.x86_64
python-0:2.7.5-34.el7.x86_64
python-0:2.7.5-38.el7_2.x86_64
python-0:2.7.5-39.el7_2.x86_64
python-0:2.7.5-48.el7.x86_64
python-0:2.7.5-58.el7.x86_64
python-0:2.7.5-68.el7.x86_64
python-0:2.7.5-69.el7_5.x86_64
python-0:2.7.5-76.el7.x86_64

Download the wanted RPM

  • Install yumdownloader
yum install yum-utils
  • Call it
yumdownloader <package>
# example
sudo yumdownloader python-2.7.5-48.el7
# example with dependencies
yumdownloader --resolve  python-2.7.5-48.el7
Loaded plugins: langpacks, product-id
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
python-2.7.5-48.el7.x86_64.rpm                      |  90 kB  00:00:00

Install

rpm are cpio file, you unzip them with the rpm2cpio command

rpm2cpio python-2.7.5-48.el7.x86_64.rpm | cpio -idv
./usr/bin/pydoc
./usr/bin/python
./usr/bin/python2
./usr/bin/python2.7
./usr/share/doc/python-2.7.5
./usr/share/doc/python-2.7.5/LICENSE
./usr/share/doc/python-2.7.5/README
./usr/share/man/man1/python.1.gz
./usr/share/man/man1/python2.1.gz
./usr/share/man/man1/python2.7.1.gz
  • Run it
cd ./usr/bin/
./python
Python 2.7.5 (default, Sep 12 2018, 05:31:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Documentation / Reference


Powered by ComboStrap