Top/Lang/Python/pip

目次

pip

pip の install --- OSのパッケージシステムを利用する場合

  1. debian の場合は以下でインストールする:
    # apt-get install python-pip python3-pip

pip の install --- OSのパッケージシステムを利用しない場合

  1. get-pip.py を入手する
    $ curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
  2. get-pip.py を使って pip3 をインストールする
    $ python3 get-pip.py
    
    Defaulting to user installation because normal site-packages is not writeable
    Collecting pip
      Downloading pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
         |████████████████████████████████| 1.4 MB 3.1 MB/s 
    Collecting setuptools
      Downloading setuptools-46.0.0-py3-none-any.whl (582 kB)
         |████████████████████████████████| 582 kB 5.5 MB/s 
    Collecting wheel
      Downloading wheel-0.34.2-py2.py3-none-any.whl (26 kB)
    Installing collected packages: pip, setuptools, wheel
      WARNING: The scripts pip, pip3 and pip3.5 are installed in '/home/yourname/.local/bin' which is not on PATH.
      Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
      WARNING: The scripts easy_install and easy_install-3.5 are installed in '/home/yourname/.local/bin' which is not on PATH.
      Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
      WARNING: The script wheel is installed in '/home/yourname/.local/bin' which is not on PATH.
      Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
    Successfully installed pip-20.0.2 setuptools-46.0.0 wheel-0.34.2
    • root にならなくても実行出来る。その場合、上記ログのように、 ${HOME}/.local/.bin 以下にインストールされる。
      $ ls ~/.local/
      bin  lib  share  tmp
      
      $ ls ~/.local/bin
      easy_install  easy_install-3.5  pip  pip3  pip3.5  wheel
      
      $ ls ~/.local/lib/python3.5/site-packages/
      __pycache__      pip-20.0.2.dist-info  setuptools-46.0.0.dist-info
      easy_install.py  pkg_resources         wheel
      pip              setuptools            wheel-0.34.2.dist-info
  3. ${HOME}/.local/bin を環境変数 PATH に加えれば、pip/pip3 が使用可能になる。

pip を使った Python モジュールの管理

バージョンを指定してモジュールをインストールする

どんなバージョンがあるかを知りたい場合


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2024-05-02 (木) 00:25:05