How can I find the installed python-lxml version in a Linux system?
>>> import lxml
>>> lxml.__version__
Traceback (most recent call last):
F
I assume you want to determine lxml
's version programatically from Python. Since lxml
does not provide this information via way of a typilca __version__
attribute on the top-level package you will have to resort to using setuptools
' pkg_resources.require()
function:
>>> from pkg_resources import require
>>> match = require("lxml")
>>> match
[lxml 3.3.0beta1 (/home/prologic/lib/python2.7/site-packages)]
>>> lxml = match[0]
>>> lxml.version
'3.3.0beta1'