yamashiro0110の日記

yamashiro0110の日記です。おもにIT技術のメモを綴っていきます(^o^)

setuptoolsとpipのインストール

Pythonのパッケージ管理システム"setuptools"と"pip"

  • 環境
$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.9.2
BuildVersion:   13C64

setuptoolsのインストール

pipにはsetuptoolsが必要なので先にインストール

your system has curl installed, follow the wget instructions but replace wget with curl and -O with -o. For example:

$ curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -o - | python

これだとパーミッションエラーが発生したので、sudoをつけて実行

$ curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -o - | sudo python

pipのインストール

setuptoolsがインストールできてる場合、easy_installが使える。 そして、pipはsetuptoolsを使ってインストールする

$ sudo easy_install pip

インストールに成功したらバージョンを確認してみる

$ pip -V
pip 1.5.4 from /Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg (python 2.7)

オプション

$ pip -h

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  zip                         DEPRECATED. Zip individual packages.
  unzip                       DEPRECATED. Unzip individual packages.
  bundle                      DEPRECATED. Create pybundles.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output.
  --log-file <path>           Path to a verbose non-appending log, that only logs failures. This log is active by default at /Users/${USER_NAME}/Library/Logs/pip.log.
  --log <path>                Path to a verbose appending log. This log is inactive by default.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
  --cert <path>               Path to alternate CA bundle.