python 模块 版本
The ideal way of installing python libraries are using PIP (Python Package Manager). PIP provides an option to verify the version of the installed modules.
安装python库的理想方法是使用PIP(Python软件包管理器)。 PIP提供了一个选项来验证已安装模块的版本。
The command to use to verify the version of the installed modules is:
用于验证已安装模块版本的命令为 :
pip freeze
(venv) bash$:src XYZ$ pip freeze
notebook==6.0.2
numpy==1.17.2
openpyxl==3.0.2
pandas==0.25.3
pandocfilters==1.4.2
parso==0.5.2
pexpect==4.7.0
pickleshare==0.7.5
prometheus-client==0.7.1
prompt-toolkit==3.0.2
ptyprocess==0.6.0
Pygments==2.5.2
pynb==0.1.36
pyrsistent==0.15.6
python-dateutil==2.8.1
pytz==2019.3
pyzmq==18.1.1
qtconsole==4.6.0
Send2Trash==1.5.0
six==1.13.0
soupsieve==1.9.5
SQLAlchemy==1.3.12
terminado==0.8.3
testpath==0.4.4
tornado==6.0.3
traitlets==4.3.3
wcwidth==0.1.8
webencodings==0.5.1
widgetsnbextension==3.5.1
The above list might be very exhaustive and in order to verify the version of a given module use the below command,
上面的列表可能非常详尽,为了验证给定模块的版本,请使用以下命令,
(venv) bash:src XYZ$ pip freeze | grep pandas
pandas==0.25.3
Another option to verify the version of the module (without using PIP) is as follows,
验证模块版本(不使用PIP)的另一种方法如下:
# import the module
import pandas as pd
# print the version
print(pd.__version__)
Output
输出量
0.25.3
The above method is cumbersome in case we want to verify the version of multiple modules, as we have to write a print statement for every module. Hence the PIP way of verifying the version is preferred.
如果我们要验证多个模块的版本,上述方法比较麻烦,因为我们必须为每个模块编写一条打印语句。 因此,首选使用PIP验证版本。
翻译自: https://www.includehelp.com/python/how-to-check-version-of-python-modules.aspx
python 模块 版本