Python - pip - 検索・一覧表示

 クラウディア
1. ヘルプ
2. 検索
3. 一覧表示

1. ヘルプ

 ヘルプを参照するには

$ pip help

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
 これでコマンドの一覧が参照できますので、さらに

pip コマンド -h
 とできますので、コマンドのオプションを調べることができます。

2. 検索

 パッケージの検索は

pip search パッケージ名
 なのですが、これは、こけます。  事情は、別のページに書いています。

3. 一覧表示

 インストール済のパッケージの一覧を表示するには

pip list
 これで、パッケージ名を少し絞り込もうとしたら

$ pip list | grep パッケージ名
EPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
 メッセージの部分が赤字で出力されちゃいまして、どうも | 以下もオプションとして解釈され、だめだよと言われているようです。

pip list > ファイル名
 これもメッセージは出力されますが、ファイルへのリダイレクトはできるようで、ファイルの中身を見ることができました。