0
1

More than 1 year has passed since last update.

pythonでパッケージのVersion確認

Posted at

パッケージ,ライブラリ,モジュールのバージョン確認の方法をいつも調べてるので,めもってゆく~

ターミナルでpythonを起動した場合

  1. import hogehoge
  2. hogehoge.__version__を表示する(printなど)
terminal(numpyの場合)
~/ python 
>>> import numpy
>>> print(numpy.__version__)

pipを使う場合

  • listでパッケージ名とバージョンを一括表示
terminal
pip3 list
Package         Version
--------------- -------
cycler          0.11.0
fonttools       4.33.0
kiwisolver      1.4.2
matplotlib      3.5.1
numpy           1.22.3
packaging       21.3
Pillow          9.1.0
pip             22.0.4
       ...

*自分の環境ではpip3でしたが、環境によってはpipかもです。

  • showで特定のパッケージのバージョンを確認
terminal
pip3 show hogehoge

自分はpipが手軽なのでよくそれを使います。
他にも見つかれば随時追加していきます。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1