How to check package version in Python
In this post you can find how to check the package versions with pip and Python.
(1) Check single package version - Python > 3.8
from importlib.metadata import version
version('moviepy')
result:
'2.0.0.dev2'
(2) Check single package version - pip freeze and grep
pip freeze | grep moviepy
result:
moviepy==2.0.0.dev2
(3) Check all packages in current environment
pip freeze
(4) Check package version and package details (requirements etc)
!pip show moviepy
!pip show moviepy | grep Version
result of first command is:
Name: moviepy
Version: 2.0.0.dev2
Summary: Video editing with Python
Home-page: https://zulko.github.io/moviepy/
Author: Zulko 2017
Author-email:
License: MIT License
Location: /home/user/Software/Tensorflow/environments/venv38/lib/python3.8/site-packages
Requires: requests, proglog, imageio-ffmpeg, numpy, imageio, decorator
Required-by:
(5) Show current used package version
If you install a new version but the previous one was imported. This will result in displaying which one is currently used.
import moviepy
moviepy.__version__
result:
'1.0.3'
(5) Install specific pre-release version in Python
pip install 'moviepy>=1.0.3' --pre
To check which is the installed version of a given Python package use:
from importlib.metadata import version
version('moviepy')
result:
'2.0.0.dev2'
You can read more about pip install here: