title: Python 3.1.2 + Snow Leopard + lxml + XMLSchema
body: <p>I'd like to use lxml library to validate XML Schemas in Python 3.1.2.</p>
  
  <p>Since the Snow Leopard MAC OS comes with the Python 2.6.1 installed, firstly, I downloaded the Python 3.1.2 automated installer at <a href="http://www.python.org/ftp/python/3.1.2/python-3.1.2-macosx10.3-2010-03-24.dmg" rel="nofollow noreferrer">http://www.python.org/ftp/python/3.1.2/python-3.1.2-macosx10.3-2010-03-24.dmg</a> and installed it.</p>
  
  <p>Secondly, I downloaded lxml 2.2.6 at <a href="http://pypi.python.org/packages/source/l/lxml/lxml-2.2.6.tar.gz" rel="nofollow noreferrer">http://pypi.python.org/packages/source/l/lxml/lxml-2.2.6.tar.gz</a>, unpacked it and performed the installation as stated in <a href="http://wiki.python.org/moin/CheeseShopTutorial" rel="nofollow noreferrer">http://wiki.python.org/moin/CheeseShopTutorial</a> (i.e.:)</p>
  
  <pre><code>  $ cd lxml-2.2.6
    $ python setup.py install
  </code></pre>
  
  <p>It installed the package with no troubles at my Python 2.6 distribution site-packages directory (/Library/Python/2.6/site-packages), but I'd like to have it installed in my Python 3.1 distribution site-packages directory (/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages).</p>
  
  <p>I tried to replace <code>python setup.py install</code> with <code>python3 setup.py install</code>, but I've got a lot of error messages in the console. Installing the lxml by using <code>easy_install lxml</code> had the same effect.</p>
  
  <p>As a last resort, I tried simply to move the content of the Python 2.6 distribution site-packages directory to the Python 3.1 distribution site-packages directory and run a test script like this:</p>
  
  <pre><code>try:
      from lxml import etree
      print("running with lxml.etree")
  except ImportError:
      try:
          # Python 2.5
          import xml.etree.cElementTree as etree
          print("running with cElementTree on Python 2.5+")
      except ImportError:
          try:
              # Python 2.5
              import xml.etree.ElementTree as etree
              print("running with ElementTree on Python 2.5+")
          except ImportError:
              try:
                  # normal cElementTree install
                  import cElementTree as etree
                  print("running with cElementTree")
              except ImportError:
                  try:
                      # normal ElementTree install
                      import elementtree.ElementTree as etree
                      print("running with ElementTree")
                  except ImportError:
                      print("Failed to import ElementTree from any known place")
  
  
  schema_root = etree.parse('note.xsd').getroot()
  schema = etree.XMLSchema(schema_root)
  parser = etree.XMLParser(schema = schema)
  root = etree.parse('note.xml', parser)
  </code></pre>
  
  <p>And I got this error message in the console:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/eduardo/Workspace/PythonToolbox/TestProject/src/testproject/domparse.py", line 97, in &lt;module&gt;
      schema = etree.XMLSchema(schema_root)
  AttributeError: 'module' object has no attribute 'XMLSchema'
  running with cElementTree on Python 2.5+
  </code></pre>
  
  <p>As suggested by Ned Deily, I did the following:</p>
  
  <pre><code>$ curl http://pypi.python.org/packages/source/l/lxml/lxml-2.2.6.tar.gz | tar xz 
  $ cd lxml-2.2.6
  $ python3 setup.py install
  </code></pre>
  
  <p>But I've got some compiler error messages, the file <a href="http://www.educoelho.com/files/output.txt" rel="nofollow noreferrer">http://www.educoelho.com/files/output.txt</a></p>
  
  <p>How can I get lxml running in Python 3.1?</p>
  
  <p>Thanks in advance.</p>