I suggest using pip in place of easy_install .
(我建议使用pip代替easy_install 。)
With pip, you can list all installed packages and their versions with (使用pip,您可以列出所有已安装的软件包及其版本)
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系统中,您可以将其传递给grep
(或Windows上的findstr
)以查找您感兴趣的特定包的行:)
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:
(对于单个模块,您可以尝试__version__
属性 ,但是有没有它的模块:)
$ 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.
(最后,由于您的问题中的命令以sudo
为前缀,您似乎正在安装到全局python环境中。)
Strongly advise to take look into python virtual environment managers, for example virtualenvwrapper (强烈建议您查看python 虚拟环境管理器,例如virtualenvwrapper)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…