ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming»
  • Programming Languages

Python Installation Issue And Resolution On Redhat Linux.

Updated on August 26, 2015

Your first step to learn Python is to get it installed. Though it’s easy to install python on UNIX And now days most of latest Linux Operating Systems comes with default python. But if you are intended to high level python programming then you need to add some additional packages, tools or libraries. That need upgrade or re-install a fresh instance for higher version of python. During update or re-install, process, you may encounter installation issues at an extent. I am attempting to endeavor a list of such issues and deliver possible resolution, to identify and fix these problem easily and quickly.

1. Download Python by using "wget" command.

You can get security certificate issue to download by wget option, for SSL network and for https (Secure) link. If you are installing python from, you will get error;

“Unable to establish SSL connection” to resolve this issue you need to use wget command with “–no-check” option.

Error message:
[root@linpuba166 bin]# wget --2015-09-08 13:37:46-- Resolving onnecting to||:443... connected. ERROR: cannot verify's certificate, issued by `/C=US/O=DigiCert Inc/ SHA2 Extended Validation Server CA': Unable to locally verify the issuer's authority. To connect to insecurely, use `--no-check-certificate'.
 Unable to establish SSL connection.


Use wget with Option "--no-Check". This will allow, to Download without check for secure connection.
"wget --no-check"

2. Wrong (older) python version is displayed.

Older python version is displayed for command,
"$python -V" and "$which python"

One of the most common error "You installed python version 3* (any later version) and set environment PATH for current version. But your python installation is showing older (previous) version.

Say for example, I had installed newr version of python (3.4.3) and set path for current version. Still my default python version is displayed as "2.4.6", older version of python.

$which python

python -V
Python 2.4.6

python3 -V
Python 3.4.3


You need to check for default python path entry from PATH and startup files like bashrc and profile. Any from these 3 could be the possible reason,

  • System PATH is not set correctly.
  • bashrc or profile files contains previous python path.
  • Previous installed python path hard linked for python library file.

  • Reset System PATH.

Find the correct path for (newer) python and (Say, path for required default python version is "/PATH"), then command to set path is,

$ export PATH=”echo$PATH”:/PATH

  • System start-up or profile has previous path.

Your current python path to system startup file. You can edit that manually or use below command. Say my current python path is "/opt/python3,4/bin", then command will be -

echo 'export PATH="$PATH:/opt/python3.4.3/bin"' >> ~/.bashrc
echo 'export PATH="$PATH:/opt/python3.4.3/bin"' >> ~/.profile
export PYTHONDOCS=/usr/share/doc/python-3.4.3/html

To update PATH manually,

$vi ~/.bashrc
#Add python PATH in file,

vi ~/.profile
#Add python PATH in file,

3. Can't update newer (later) python details for, $which python.

Updated correct path for Python to System $PATH and updated profile and bashrc files .
But command “$which python, is still showing older python version.


You need to check 2 most possible scenarios to fix this issue,

  • Possibly your system PATH has entry for both versions of python. Where first entry is for older version of python.
  • You have hard/soft linked path of old python to default python.

Update Path: For example. If you had installed python at path, /opt/python3.4.3/ then you can update path by commands,

echo 'export PATH=opt/python3.4.3/bin:”$PATH”
echo 'export PATH="$PATH:/opt/python3.4.3/bin"' >> ~/.bashrc
echo 'export PATH="$PATH:/opt/python3.4.3/bin"' >> ~/.profile

Remove hard/soft link: If you had created any hardlnik to "/bin/local/ python" then unlink that.

4: Issue to upgrade python.

If you are getting error "this system is not registered with RHN" , while upgrading python. You need to register with command "rhn_register".

$yum upgrade python
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Skipping security plugin, no data
Setting up Upgrade Process
No Packages marked for Update


You need to register RHN, by command,

  • $rhn_register
  • $yum list update
  • $yum update

5: Yum update fails with error "No more mirrors to try".


yum update fails with the error : [Errno 256] No more mirrors to try
yum update fails with :-Raw
Error Downloading Packages:
InstallMedia: [Errno 256] 
No more mirrors to try.


Seems your system is not registered with RHN Classic. If the system is registered to RHN Classic, only rhel-source.repo should be present under /etc/yum.repos.d/. you need remove any local repositories, or any other media repositories.

Check if system is registered with RHN Classic,
$cd /etc/yum.repos.d/ | ls rhel-source | wc –l

This should result 1, If – system is registered with RHN Classic. Else output will be 0.
If system is registered with RHN Classic then you shouldn’t get this error. If system is not registered with RHN Classic then you need to check and remove all other local repositories.

Check and remove, if any other local repository present,

$cd //etc/yum.repos.d/ | ls .* | wc –l
OUTPUT: If output of above command is >1, Then you need to remove all local repository files.

Remove local repository by <repository name>, and old yum cache from system
$rm -rf /etc/yum.repos.d/<lrepository name>
$rm -fr /var/cache/yum/*
$yum clean all

List the valid repositories $yum repolist This should resolve the issue, you may gey more details from Redhat support site: "".

6: Issue to remove Python files and directories for older (default) python version.

Uninstalled python by command,
$yum uninstall python


If previous python instance was installed bu easy_install method. Then yum uninstall will not remove some of the files. You need to remove them. Follow these steps to remove older files.
[consider example commands to remove older version 2.4, you need to replace the version with the version observed in your system]].

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

$rm -f /usr/local/bin/python2.4*
$rm -f /usr/local/bin/pip2.4*
$rm -f /usr/local/bin/pydoc
$rm -rf /usr/local/bin/include/python2.4*
$rm -f /usr/local/lib/libpython2.4*.a
$rm -rf /usr/local/lib/python2.4*
$rm -f /usr/local/share/man/python2.4*.1
$rm -rf /usr/local/lib/pkgconfig
$rm -f /usr/local/bin/idle
$rm -f /usr/local/bin/easy_install-2.4*

7: Yum Command Not Working.


"-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory". 
 " -bash: yum: command not found".
 "-bash: /usr/bin/yum: No such file or directory".

$yum --version
There was a problem importing one of the Python modules required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or verify that the module is installed correctly.
It's possible that the above module doesn't match the current version of Python, which is:
2.6.6 (r266:84292, Nov 21 2013, 10:50:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]
If you cannot solve this problem yourself, please go to
the yum faq at:

There are couple of scenarios when you can face this issue,

  • You uninstalled default python or somehow default python is corrupted and no any other python instance is available in your system. You know, to run yum one python modules is required.
  • Wrong hard/soft linke is created for “/usr/bin/python”. OR no link is created. [Issue with python environment set].
  • Yet another possible reason is linked path doesn’t have specific files (say some files missing/deleted or corrupted from linked folder).
  • In case if, Somehow Yum got corrupted.
  • And most tricky situation to resolve, you created hard link to python files by different user (Not as a root user). Other user doesn’t have all root (+X) permissions.

Likewise, Many other scenarios are thinkable.So, now the question - how to resolve this issue?


If somehow “yum” got corrupted, then re-installation of yum will resolve the issues:

  • -bash: yum: command not found".
  • -bash: /usr/bin/yum: No such file or directory.
You need to download “yum”and reinstall as: (an example below to download and re-install yum version 3.4.3, you may select any other listed),

$tar –xvf yum-3.4.3.tar.gz
$cd yum-3.4.3
$make install

  • Check symb link, if that is pointing your correct python path.

In case of error, " -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory". You need to check if location of installed python is correct.

Scenario: Usually this happen, when you have two different versions of python and both instances are installed at different locations.
And If you uninstall default python version and install a new python at location say: /usr/local/bin/python.
If your default python instance was installed at location: /usr/bin/python
Then Issue will be: -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory.

You need to change the path for python (Symb link) to current python path and unlink previous symb link.That will resolve this error,

Hope your issue is resolved and you found this article, worthwhile to resolve your query and issue.

Was this article helpful to resolve your query?

See results


    0 of 8192 characters used
    Post Comment

    No comments yet.