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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:10:17+00:00 2026-05-28T08:10:17+00:00

On Ubuntu 10.10, I am unable to install lxml to python 2.7. Here are

  • 0

On Ubuntu 10.10, I am unable to install lxml to python 2.7. Here are the steps I take.

sudo su -
apt-get install python2.7
apt-get install python-lxml

Note when running the install for python-lxml package, the following appeared:

INFO: using unknown version '/usr/bin/python2.7' (debian_defaults not up-to-date?)"

Importing the module in python2.6 (the version that comes standard with Ubuntu) works. However, importing the module under python2.7 does not. So how does one install Python modules to a non-default Python installation?

  • 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-28T08:10:18+00:00Added an answer on May 28, 2026 at 8:10 am

    Another solution might be to use the following code:

    try:
      from lxml import etree
    except ImportError:
      try:
        # Python 2.5
        import xml.etree.cElementTree as etree
      except ImportError:
        try:
          # Python 2.5
          import xml.etree.ElementTree as etree
        except ImportError:
          try:
            # normal cElementTree install
            import cElementTree as etree
          except ImportError:
            try:
              # normal ElementTree install
              import elementtree.ElementTree as etree
            except ImportError:
              print("Failed to import ElementTree from any known place")
    

    [Source]

    This will import lxml if it is available, or the original ElementTree otherwise.

    I use this code for my application on Google App Engine (using Python 2.7): on the server it will use lxml, on my machine it will use ElementTree.

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

Sidebar

Related Questions

I'm struggling here with no success in order to install capistrano on my Ubuntu
I have been unable to get Riak working under Ubuntu 9 due to many
Ubuntu Server 9.10, Here is my file, test.py import commands blkid = commands.getoutput('blkid') print
I'va installed ubuntu server 10.41 in Vm ware, and I would like to install
I am running UBUNTU. Linux and have tried BOUML, which can show the project
I get the following error when trying to start a daemon using Ubuntu 10.04
I am using Ubuntu... I am trying to install racket from their website http://racket-lang.org/download/
I am unable to take screenshot / printscreen of my eclipse menu. when I
I am an Ubuntu Linux user. I am running jobs remotely and started a
In Ubuntu, I'm running Tomcat 6, the Tomcat version on the bottom of the

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.