I suggest using pip in place of easy_install. With pip, you can list all installed packages and their versions with
pip freeze
In most linux systems, you can pipe this to grep
(or findstr
on Windows) to find the row for the particular package you're interested in:
Linux:
$ pip freeze | grep lxml
lxml==2.3
Windows:
c:> pip freeze | findstr lxml
lxml==2.3
For an individual module, you can try the __version__
attribute, however there are modules without it:
$ python -c "import requests; print(requests.__version__)"
2.14.2
$ python -c "import lxml; print(lxml.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'
Lastly, as the commands in your question are prefixed with sudo
, it appears you're installing to the global python environment. Strongly advise to take look into python virtual environment managers, for example virtualenvwrapper
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…