パソコン関連の書籍等を読んで試したりしながらアウトプットしまくります。

アウトプットしながら学ぶ

Python コマンドプロンプト ツール プログラミング

Pythonの該当バージョンにライブラリがインストールされている確認する方法

投稿日:

Pythonの初心者がよくはまるトラブルだと思いますが、
いろいろな書籍を参考にPythonを学んでいるうちに、
インストールされているPythonのバージョンの種類が増えていきます。

その状況を考慮せず、書籍には、ライブラリをインストールするときは

pip install [ライブラリ名]

とするように書かれています。

複数のpythonが共存する環境で、このコマンドを実行すると、
おそらく、最新のバージョンにインストールされることになります。

この状況を確認する方法に関して説明します。

スポンサーリンク




Python 3.6、3.7、3.8がインストールされている状況で、
3.7と3.8にazure-cognitiveservices-vision-faceをインストールしました。

pip show azure-cognitiveservices-vision-face

結果

Name: azure-cognitiveservices-vision-face
Version: 0.4.0
Summary: Microsoft Azure Cognitive Services Face Client Library for Python
Home-page: https://github.com/Azure/azure-sdk-for-python
Author: Microsoft Corporation
Author-email: azpysdkhelp@microsoft.com
License: MIT License
Location: c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages
Requires: azure-common, msrest
Required-by:

Locationのフォルダを見るとわかりますが、Python3.8にインストールされていることがわかります。

py -3.7 -m pip show azure-cognitiveservices-vision-face

結果

Name: azure-cognitiveservices-vision-face
Version: 0.4.0
Summary: Microsoft Azure Cognitive Services Face Client Library for Python
Home-page: https://github.com/Azure/azure-sdk-for-python
Author: Microsoft Corporation
Author-email: azpysdkhelp@microsoft.com
License: MIT License
Location: c:\users\user\anaconda3\lib\site-packages
Requires: azure-common, msrest
Required-by:

anaconda3はPython3.7のバージョンなので、Python3.7にインストールされていることがわかります。

py -3.6 -m pip show azure-cognitiveservices-vision-face

結果

なし

Python3.6にはインストールされていません。

pip listでも確認することができます。
例えば、バージョン3.7を指定する場合は以下です。

py -3.7 -m pip list | findstr /B azure-cognitiveservices-vision-face







-Python, コマンドプロンプト, ツール, プログラミング

Copyright© アウトプットしながら学ぶ , 2024 AllRights Reserved Powered by AFFINGER4.