如何检查我正在运行的boto3的版本?
我尝试进入REPL并运行以下命令:
>>> import boto3
>>> boto3.Version
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'boto3' has no attribute 'Version'
答案 0 :(得分:5)
我知道这很晚了,但是您也可以使用:
pip show boto3
答案 1 :(得分:1)
尝试使用.__version__
或.version
PEP 8标准为此使用了__version__
属性,但是值得注意的是某些模块代替了实现version
。
答案 2 :(得分:1)
您始终可以使用dir函数来了解对象的所有属性和方法。
dir(boto3)
['DEFAULT_SESSION', 'NullHandler', 'Session', '__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_get_default_session', 'client', 'docs', 'exceptions', 'logging', 'resource', 'resources', 'session', 'set_stream_logger', 'setup_default_session', 'utils']
从此输出中,您可以看到__version__
。
boto3.__version__
答案 3 :(得分:0)
在终端中检查任何已安装软件包版本的替代方法
pip freeze | grep boto3
注意:你可以用任何其他包名替换 boto3