简体   繁体   中英

Check Boto3 Version

How do I check the version of boto3 I am running?

I tried going into REPL and running these commands:

>>> 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

Try using .__version__ or .version

PEP 8 standard is to use the __version__ attribute for this, however it is worth noting that some modules implement version instead.

You can always use dir function to know all the properties and methods of object.

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__ .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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