Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7665377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:32:56+00:00 2026-05-31T14:32:56+00:00

I am working on a RHEL system. I have two versions of Python installed

  • 0

I am working on a RHEL system. I have two versions of Python installed on my system: Python 2.4 and Python 2.7, but I have created an alias in the .bashrc file so that the python command prompts Python 2.7 instead of Python 2.4.

I need to install zlib in my system. I tried to install it using the yum command:
yum install zlib
yum install zlib-devel
both worked fine, but when I type “python”, I still cannot see zlib installed:

[root@mymachine]# python
Python 2.7 (r27:82500, Jan 18 2012, 17:03:29) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import zlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named zlib

But if I import zlib from Python 2.4, it works! Why? I need zlib to be installed using Python 2.7. How can I do that? Thank you in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:32:57+00:00Added an answer on May 31, 2026 at 2:32 pm

    Generally you will only find RPMs for the default Python version in the yum repository, however that shouldn’t really be applicable here since zlib should be installed by default in your Python 2.7 installation.

    Check sys.path using import sys; print sys.path and make sure that you have the lib directories for your Python 2.7 installation, it is possible that whatever you are doing in .bashrc is causing you to pick up the Python 2.4 environment.

    Here is the location of my zlib module, which may be useful in trying to track down the location of yours so you can make sure it is on sys.path.

    >>> import zlib
    >>> zlib
    <module 'zlib' from '/usr/local/lib/python2.7/lib-dynload/zlib.so'>
    

    If you cannot find it then you should reinstall Python 2.7.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working with a SqlCommand in C# I've created a query that contains a IN
Working with a Lucene index, I have a standard document format that looks something
Working in Java: I have a JFrame class, and separate classes for my two
Working with SSRS and a SQL 2000 source, I have a stored procedure that
Working on three different computers at two different locations, on projects that are in
I have a text file which contains the list of files and directories that
Working on a project at the moment and we have to implement soft deletion
Working on a project that parses a log of events, and then updates a
Working with python interactively, it's sometimes necessary to display a result which is some
Working on an extension that use the new experimental devtools apis. How do you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.