查找python lxml版本 [英] Find python lxml version

查看:138
本文介绍了查找python lxml版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Linux系统中找到已安装的python-lxml版本?

How can I find the installed python-lxml version in a Linux system?

>>> import lxml
>>> lxml.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'

>>> from pprint import pprint
>>> pprint(dir(lxml))
['__builtins__',
 '__doc__',
 '__file__',
 '__name__',
 '__package__',
 '__path__',
 'get_include',
 'os']
>>>

似乎找不到它

推荐答案

您可以通过查看etree来获取版本:

You can get the version by looking at etree:

>>> from lxml import etree
>>> etree.LXML_VERSION
(3, 0, -198, 0)

其他感兴趣的版本可以是:etree.LIBXML_VERSIONetree.LIBXML_COMPILED_VERSIONetree.LIBXSLT_VERSIONetree.LIBXSLT_COMPILED_VERSION.

Other versions of interest can be: etree.LIBXML_VERSION, etree.LIBXML_COMPILED_VERSION, etree.LIBXSLT_VERSION and etree.LIBXSLT_COMPILED_VERSION.

这篇关于查找python lxml版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆