LoginSignup
1
3

More than 3 years have passed since last update.

pytorchとtensoflowのバージョンをコマンドラインから調べる

Last updated at Posted at 2020-10-31

※追記をまとめると以下
(pytorch,tensoflow,opencv,sklearn,pandas...)

python3の場合

python3 -c 'import torch; print(torch.__version__) '
python3 -c 'import tensorflow as tf; print(tf.__version__)'
python3 -c "import sklearn;print(sklearn.__version__);"
python3 -c "import cv2 ;print(cv2.__version__);"
python3 -c "import pandas as pd ;print(pd.__version__);"
python3 -c "import torchvision;print(torchvision.__version__);"
python3 -c "import pygame; print(pygame.version.vernum);"

pythonの場合

python -c 'import torch; print(torch.__version__) '
python -c 'import tensorflow as tf; print(tf.__version__)'
python -c "import sklearn;print(sklearn.__version__);"
python -c "import cv2 ;print(cv2.__version__);"
python -c "import pandas as pd ;print(pd.__version__);"
python -c "import torchvision;print(torchvision.__version__);"
python -c "import pygame; print(pygame.version.vernum);"

pytorchでcudaが使えるかコマンドラインから確認する

python -c "import torch; print(torch.cuda.is_available()); print(torch.cuda.get_device_name(0));"
python3 -c "import torch; print(torch.cuda.is_available()); print(torch.cuda.get_device_name(0));"

pytorchとtensoflowのバージョンをコマンドラインから調べる

以下をコマンドラインから実行すればよい

python3 -c 'import torch; print(torch.__version__) '
python3 -c 'import tensorflow as tf; print(tf.__version__)'

以下のような結果がでる

$ python3 -c 'import torch; print(torch.__version__) '
1.3.0
$ python3 -c 'import tensorflow as tf; print(tf.__version__)'
1.14.0

追記

sklearnのバージョンは以下で調べる

python3 -c "import sklearn;print(sklearn.__version__);"

opencvのバージョンは以下で調べる

python3 -c "import cv2 ;print(cv2.__version__);"

pandasのバージョンは以下で調べる

python3 -c "import pandas as pd ;print(pd.__version__);"

参考

【Python/PyTorch】バージョン確認
TensorFlowのバージョンのチェック方法

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