3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pip listの警告を消す

Posted at

概要

 Python3のpipをpip 9.0.1にアップデートしたらpip listコマンドを実行する度に以下の警告メッセージが出るようになりました.

DEPRECATION: 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.

 このままでも使えるけど,実行する度に警告が出るのは鬱陶しいのでこれを出ないようにします.ちなみに環境はOSX High Sierra 10.13.2で,Pythonはhomebrewを使って入れてます.

解決策

 警告を読むと,どうやらpip 9.0からpip listを実行するときは表示形式を指定しないといけなくなったみたいです.
 毎回表示形式を指定するのは面倒なのでpipの設定ファイルに表示形式を記述します.pipの設定ファイルは,

$HOME/Library/Application Support/pip/pip.conf

にあります.存在しない場合は新規作成してください.

touch $HOME/Library/"Application Support"/pip pip.conf

※ ターミナル上で半角スペースを含むディレクトリやファイルを扱う場合は,上記のコマンドのようにダブルクォーテーション(")で囲む必要があります.

 設定ファイルに以下を追記します.

pip.conf
[list]
format=legacy

 これで警告文は表示されなくなりました.

 ちなみに表示形式には以下のものがあります.

  • legacy(従来と同じ表示形式)
numpy (1.14.0)
pip (9.0.1)
  • columns
Package         Version
--------------- -------
numpy           1.14.0
pip             9.0.1
  • freeze
numpy==1.14.0
pip==9.0.1

おわりに

 pip listを実行した時に表示される警告文を消すことができました.

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?