简体   繁体   English

检查 Boto3 版本

[英]Check Boto3 Version

How do I check the version of boto3 I am running?如何检查我正在运行的 boto3 版本?

I tried going into REPL and running these commands:我尝试进入 REPL 并运行以下命令:

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

I know this is late but you can also use:我知道这已经晚了,但您也可以使用:

pip show boto3 pip 显示 boto3

Try using .__version__ or .version尝试使用.__version__.version

PEP 8 standard is to use the __version__ attribute for this, however it is worth noting that some modules implement version instead. PEP 8 标准为此使用__version__属性,但值得注意的是,某些模块实现了version

You can always use dir function to know all the properties and methods of object.您始终可以使用 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']

From this output you can see __version__ .从这个输出你可以看到__version__

boto3.__version__

An alternative to check the version of any installed packages, In the terminal检查任何已安装软件包版本的替代方法,在终端中

pip freeze | grep boto3

Note: you can replace boto3 with any other package name注意:您可以将 boto3 替换为任何其他包名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM