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 6820289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:24:26+00:00 2026-05-26T21:24:26+00:00

I’m using Python 2.7.2 on Ubuntu 11.10. I got this error when importing the

  • 0

I’m using Python 2.7.2 on Ubuntu 11.10. I got this error when importing the bz2 module:

ImportError: No module named bz2

I thought the bz2 module is supposed to come with Python 2.7. How can I fix this problem?

EDIT: I think I previously installed Python 2.7.2 by compiling from source. Probably at that point I didn’t have libbz2-dev and so the bz2 module is not installed. Now, I’m hoping to install Python2.7 through

sudo apt-get install python2.7

But it will say it’s already installed. Is there a way to uninstall the previous Python2.7 installation and reinstall?

  • 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-26T21:24:26+00:00Added an answer on May 26, 2026 at 9:24 pm

    Okay, this is much easier to understand in answer form, so I’ll move what I would write in my comment to this answer.

    Luckily for you, you didn’t overwrite the system version of python, as Ubuntu 11.10 comes with 2.7.2 preinstalled.

    Your python binaries (python and python2.7) are located in /usr/local/bin, which is a directory where user-specific stuff is usually installed. This is fine, it means your system python is still there.

    First, just try to run the system python. Type this from the command line:

    /usr/bin/python -c "import bz2; print bz2.__doc__"
    

    This should print out something like this:

    λ > /usr/bin/python -c "import bz2; print bz2.__doc__"
    
    The python bz2 module provides a comprehensive interface for
    the bz2 compression library. It implements a complete file
    interface, one shot (de)compression functions, and types for
    sequential (de)compression.
    

    If so, means you’re fine.

    So you just have to fix your PATH, which tells the shell where to find commands. /usr/local/bin is going to have priority over /usr/local, so there are some ways to fix this, in order of difficulty/annoyance/altering your system:

    Remove the symlink python from /usr/local/bin

    This will make it so that when you type python, it should go back to executing /usr/bin/python, which is an alias for the system’s python 2.7.2.

    sudo rm /usr/local/bin/python
    

    Move /usr/bin to have higher precedence in the PATH

    Might not be desirable if you already have stuff in /usr/local/bin that should have precedence over /usr/bin, but I’m adding this for completeness.

    In your shell profile (not sure what Ubuntu’s default is, but I’m using ~/.bash_profile, you can do this:

    export PATH=/usr/bin:$PATH
    

    Remove your python install

    This is extreme and the first option I presented should be your first option.

    Do you really need your own version of Python? If you want isolated python environments you probably really want virtualenv. You can probably remove yours unless there’s a reason not to.

    It’s going to be a little annoying though, but basically:

    • Remove the python and python2.7 and pythonw and pythonw2.7 commands from /usr/local/bin.
    • Remove /usr/local/lib/python/2.7.2

    This part is not complete because I forget what else there is.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm making a simple page using Google Maps API 3. My first. One marker
We're building an app, our first using Rails 3, and we're having to build

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.