LoginSignup
13
18

More than 5 years have passed since last update.

pip listでwarningメッセージが表示されたときの対処

Last updated at Posted at 2016-12-05

概要

  • pipを9.0.1にアップデートしたところ pip list でwarningメッセージが表示されるようになって邪魔なので黙らせる。

経緯

  • 「pipコマンドをアップグレードしない?」と言われたので
$ pip list
pip (8.1.1)
setuptools (20.3)
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
  • 勧められるままアップグレードしたところ
$ pip install --upgrade pip
Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Uninstalling pip-8.1.1:
      Successfully uninstalled pip-8.1.1
Successfully installed pip-9.0.1
  • なんかwarningが表示されるようになった(悲)
$ 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.
pip (9.0.1)
setuptools (20.3)

対処方針

  • メッセージ通り、pip.confに記述します。
  • ただ、自分の環境にはpip.confがなかったので少し迷いました。
  • 自分の環境とは、virtualenvでPythonを切り替えるものです。(→ Amazon Linux上にPython3.5.2の環境を導入する

対処手順

  • Pythonのトップディレクトリに pip.conf を設置すると読み込んでくれるようです。
  • ~/py352 へPythonをインストールしてある場合は、そのディレクトリ直下です。
  • formatcolumnsまたはlegacyを指定します
~/py352/pip.conf
[list]
format=columns

確認

  • warningメッセージ無しで表示されるようになりました。
$ pip list
Package    Version
---------- -------
pip        9.0.1
setuptools 20.3
13
18
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
13
18