Sabtu, 09 September 2023

How-to-check-version-of-python-modules

How To Check Python Modules Using pip freeze

First step is open Command Line, and then:

To list all installed Python modules with their version numbers, use the following command:

  1. pip freeze
  2. and then press Enter on the keyboard.

To individually find the version number you can grep on this output on *NIX machines. For example:

  1. $ pip freeze | grep PyMySQL
  2. and then press Enter on the keyboard.
  3. The sample result:
    PyMySQL==0.7.11

On windows, you can use findstr instead of grep. For example:

  1. PS C:\> pip freeze | findstr PyMySql
  2. and then press Enter on the keyboard.
  3. The sample result:
    PyMySQL==0.7.11

Notes

  • pip freeze shows packages that you only installed via pip or pipenv command tool.
  • pip freeze excludes package management tools such as pip, wheeldistribute and setuptools, which are not needed for porting environments via requirements.txt, making it ideal for this purpose.
  • pip freeze generate output suitable for a requirements file (requirements.txt).

How To Check Python Modules Using pip list

To list all installed Python modules with their version numbers, use the following command:
  1. open Command Line, and then:
    pip list
  2. and then press Enter on the keyboard.
  3. The sample result:
    Package                             Version
    ---------------------------------- ----------
    PyMySQL                             0.7.11

To individually find the version number you can grep on this output on *NIX machines. For example:

  1. $ pip list | grep PyMySQL
  2. and then press Enter on the keyboard.
  3. The sample result:
    Package                             Version
    ---------------------------------- ----------
    PyMySQL                             0.7.11

On windows, you can use findstr instead of grep. For example:

  1. PS C:\> pip list | findstr PyMySql
  2. and then press Enter on the keyboard.
  3. The sample result:
    Package                             Version
    ---------------------------------- ----------
    PyMySQL                             0.7.11

How To List All Python Modules Index

to list all installed Python modules with python console, 

  1. Open Command Line
  2. type python command.
    and then press Enter on the keyboard.
  3. use the following command:
    help("modules")
    and then press Enter on the keyboard.
  4. The result will be display all Python modules index that are available after you have installed.

    display all Python modules index

If you want to quit from python console, type quit() command.

Warning:
If you have many installed Python modules, maybe thousands or more, there might be a potential of many spent time to show, so it is not surprising that it might hang your Python interactive console / Python interpreter / Python shell.

Bibliography:

https://docs.python.org/

https://pip.pypa.io/en/stable/

https://www.activestate.com/

https://realpython.com/

https://stackoverflow.com/

https://note.nkmk.me/en/

https://www.tutorialspoint.com/

https://www.digitalocean.com/

Related Topics:

Tidak ada komentar:

Posting Komentar

Various Other Posts