python:pip

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
python:pip [2020/01/31 05:46] ともやんpython:pip [2024/03/28 01:58] (現在) – [仮想環境の pip を最新版に更新する場合] ともやん
行 1: 行 1:
 +====== pip - Python パッケージ管理システム ======
 +{{:python:jr_soya-main-line_pippu_station-name_signboard.jpg?360|読み方的に...😅💦}}\\
 +[[https://commons.wikimedia.org/wiki/File:JR_Soya-Main-Line_Pippu_Station-name_signboard.jpg|File:JR Soya-Main-Line Pippu Station-name signboard.jpg - Wikimedia Commons]] より\\
 +読み方的に...😅💦\\
 +
 +本家: [[https://www.pypa.io/en/latest/|Python Packaging Authority — PyPA documentation]] ([[https://www-pypa-io.translate.goog/en/latest/?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\
 +ソースコード: [[git>pypa/pip|pypa/pip: The Python package installer]]\\
 +ドキュメント: [[https://pip.pypa.io/|pip documentation v23.0.1]] ([[https://pip-pypa-io.translate.goog/?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\
 +ユーザーガイド: [[https://pip.pypa.io/en/stable/user_guide/|User Guide - pip documentation v23.0.1]] ([[https://pip-pypa-io.translate.goog/en/stable/user_guide/?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\
 +
 +===== pip オプション一覧 =====
 <html> <html>
   <style>   <style>
-    #pip table +    div.pip_option_list .col0 
-      min-width: 50%+      width: 50%;
-      width: initial;+
     }     }
-    #pip table pre { +    div.pip_option_list pre { 
-      padding: 0; +      min-widthunset;
-      margin: 0 0 2px 0; +
-      word-wrap: inherit; +
-    } +
-    #pip table td { +
-      padding2px;+
     }     }
   </style>   </style>
 +  <div class="pip_option_list">
 </html> </html>
-====== pip コマンド ====== 
-pip オプション一覧 
-<WRAP #pip> 
 ^  コマンド  ^  説明  ^ ^  コマンド  ^  説明  ^
-|<code>$ python -m pip install --upgrade pip</code>|pip 自体を更新する。 +|<WRAP color_term> 
-|<code>$ pip freeze</code>|インストール済みパッケージを一覧表示する。 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> pip install <b class=HIK>--upgrade</b> pip</pre></html></WRAP> 
-|<code>$ pip search Django</code>|パッケージを検索する。 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> pip install <b class=HIK>-U</b> pip</pre></html></WRAP> 
-|<code>$ pip install Django</code>|パッケージをインストールする。 +</WRAP> |pip 自体を更新する。 
-|<code>$ pip install Django==1.4.2</code>|パッケージバージョンを指定してインストールする。 +|<WRAP color_term> 
-|<code>$ pip install Django -I</code>|インストール済みパッケージを無視して再インストールする。 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> list</pre></html></WRAP> 
-|<code>$ pip install Django -U</code>|パッケージをアップグレードする。 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> list <b class=HIK>-v</b></pre></html></WRAP> 
-|<code>$ pip uninstall Django</code>|パッケージをアンインストする。 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> list <b class=HIK>--verbose</pre></html></WRAP> 
-|<code>$ pip uninstall Django</code>|パッケージをアンインストールする。 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> freeze</pre></html></WRAP> 
-|<code>$ pip freeze > pkglist.txt +</WRAP> |インストール済みパッケージを一覧表示する。 
-$ pip install -r pkglist.txt</code>|venv などの環境を複製する。 +|<WRAP color_term> 
-|<code>$ pip freeze > pkglist.txt +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> list <b class=HIK>-o</b></pre></html></WRAP> 
-$ pip uninstall -r pkglist.txt -y</code><code>$ pip freeze | xargs pip uninstall -y</code><code>$ pip freeze | grep -v "^-e" | xargs pip uninstall -y</code>|全パッケージを確認なしでアンインストールする。 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> list <b class=HIK>--outdated</b></pre></html></WRAP> 
-|<code>$ pip -V</code>|バージョンを表示する。  |+</WRAP> |インストール済みのうち古くなっているパッケージを一覧表示する。  |  
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> search Django</pre></html></WRAP> 
 +</WRAP> |パッケージを検索する。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> install Django</pre></html></WRAP> 
 +</WRAP> |パッケージをインストールする。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> install Django==1.4.2</pre></html></WRAP> 
 +</WRAP> |パッケージバージョンを指定してインストールする。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> install <b class=HIK>--ignore-installed</b> Django</pre></html></WRAP> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> install <b class=HIK>-I</b> Django</pre></html></WRAP> 
 +</WRAP> |インストール済みパッケージを無視して再インストールする。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> install wxpython <b class=HIK>-I --no-cache-dir</b></pre></html></WRAP> 
 +</WRAP> |インストール済みとキャッシュ有無を無視してインストールする。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> install <b class=HIK>--upgrade</b> Django</pre></html></WRAP><WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> install <b class=HIK>-U</b> Django</pre></html></WRAP> 
 +</WRAP> |パッケージをアップグレードする。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> freeze <b class=HIK>--local</b> | <b class=HIY>grep</b> <b class=HIK>-v</b> '^\-e' | <b class=HIY>cut</b> <b class=HIK>-d</b> = <b class=HIK>-f</b> 1 | <b class=HIY>xargs</b> pip install <b class=HIK>-U</b> pip</pre></html></WRAP> 
 +</WRAP> |全パッケージをアップグレする。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> list <b class=HIK>--outdated</b> | <b class=HIY>sed</b> 1,2d | <b class=HIY>cut</b> <b class=HIK>-f</b> 1 <b class=HIK>-d</b> ' ' | <b class=HIY>xargs</b> <b class=HIK>--no-run-if-empty</b> pip install <b class=HIK>--upgrade</b></pre></html></WRAP> <WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> list <b class=HIK>-o</b> | <b class=HIY>sed</b> 1,2d | <b class=HIY>cut</b> <b class=HIK>-f</b> 1 <b class=HIK>-d</b> ' ' | <b class=HIY>xargs</b> <b class=HIK>-r</b> pip install <b class=HIK>-U</b></pre></html></WRAP> 
 +</WRAP> |更新可能がパッケージをすべてアップグレードする。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> uninstall Django</pre></html></WRAP> 
 +</WRAP> |パッケージをアンインストールする。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> freeze > requirements.txt 
 +<b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> pip install <b class=HIK>-U</b> pip 
 +<b class=GRN>$</b> <b class=HIY>pip</b> install <b class=HIK>-r</b> requirements.txt</pre></html></WRAP> 
 +</WRAP> |venv などの環境を複製する。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> freeze > requirements.txt 
 +<b class=GRN>$</b> <b class=HIY>pip</b> uninstall <b class=HIK>-r</b> requirements.txt <b class=HIK>-y</b> 
 +</pre></html></WRAP> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> freeze | <b class=HIY>xargs</b> pip uninstall <b class=HIK>-y</b> 
 +</pre></html></WRAP> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> freeze | <b class=HIY>grep</b> <b class=HIK>-v</b> "^-e"<b class=HIY>xargs</b> pip uninstall <b class=HIK>-y</b> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">pip</font> freeze <font color="#A347BA">--user</font> <font color="#12488B"><b>|</b></font> <font color="#26A269">grep</font> <font color="#A347BA">-v</font> <font color="#A2734C">&quot;^-e&quot;</font> <font color="#12488B"><b>|</b></font> <font color="#26A269">cut</font> <font color="#A347BA">-f</font> 1 <font color="#A347BA">-d</font> <font color="#A2734C">&apos;=&apos;</font> <font color="#12488B"><b>|</b></font> <font color="#26A269">xargs</font> pip uninstall <font color="#A347BA">-y</font> 
 +</pre></html></WRAP> 
 +</WRAP> |全パッケージを確認なしでアンインストールする。 
 +|<WRAP color_term> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> <b class=HIK>--version</b></pre></html></WRAP> 
 +<WRAP color_command><html><pre><b class=GRN>$</b> <b class=HIY>pip</b> <b class=HIK>-V</b></pre></html></WRAP> 
 +</WRAP> |バージョンを表示する。  | 
 +<html> 
 +  </div> 
 +</html> 
 + 
 +===== pip のヘルプ ===== 
 +pip の詳細は以下の公式ドキュメントを参照のこと。\\ 
 +[[https://pip.pypa.io/en/stable/|Home - pip documentation v21.1.1]]\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> 
 +</pre></html></WRAP> 
 +<WRAP color_result_long><html><pre> 
 + 
 +Usage:    
 +  pip &lt;command> [options] 
 + 
 +Commands: 
 +  install                     Install packages. 
 +  download                    Download packages. 
 +  uninstall                   Uninstall packages. 
 +  freeze                      Output installed packages in requirements format. 
 +  inspect                     Inspect the python environment. 
 +  list                        List installed packages. 
 +  show                        Show information about installed packages. 
 +  check                       Verify installed packages have compatible dependencies. 
 +  config                      Manage local and global configuration. 
 +  search                      Search PyPI for packages. 
 +  cache                       Inspect and manage pip's wheel cache. 
 +  index                       Inspect information available from package indexes. 
 +  wheel                       Build wheels from your requirements. 
 +  hash                        Compute hashes of package archives. 
 +  completion                  A helper command used for command completion. 
 +  debug                       Show information useful for debugging. 
 +  help                        Show help for commands. 
 + 
 +General Options: 
 +  -h, --help                  Show help. 
 +  --debug                     Let unhandled exceptions propagate outside the main subroutine, instead of 
 +                              logging them to stderr. 
 +  --isolated                  Run pip in an isolated mode, ignoring environment variables and user 
 +                              configuration. 
 +  --require-virtualenv        Allow pip to only run in a virtual environment; exit with an error otherwise. 
 +  --python &lt;python>           Run pip with the specified Python interpreter. 
 +  -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. Option is additive, and can be used up to 3 times 
 +                              (corresponding to WARNING, ERROR, and CRITICAL logging levels). 
 +  --log &lt;path>                Path to a verbose appending log. 
 +  --no-input                  Disable prompting for input. 
 +  --proxy &lt;proxy>             Specify a proxy in the form scheme://[user:passwd@]proxy.server:port. 
 +  --retries &lt;retries>         Maximum number of retries each connection should attempt (default 5 times). 
 +  --timeout &lt;sec>             Set the socket timeout (default 15 seconds). 
 +  --exists-action &lt;action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, 
 +                              (b)ackup, (a)bort. 
 +  --trusted-host &lt;hostname>   Mark this host or host:port pair as trusted, even though it does not have 
 +                              valid or any HTTPS. 
 +  --cert &lt;path>               Path to PEM-encoded CA certificate bundle. If provided, overrides the 
 +                              default. See 'SSL Certificate Verification' in pip documentation for more 
 +                              information. 
 +  --client-cert &lt;path>        Path to SSL client certificate, a single file containing the private key and 
 +                              the certificate in PEM format. 
 +  --cache-dir &lt;dir>           Store the cache data in &lt;dir>
 +  --no-cache-dir              Disable the cache. 
 +  --disable-pip-version-check 
 +                              Don't periodically check PyPI to determine whether a new version of pip is 
 +                              available for download. Implied with --no-index. 
 +  --no-color                  Suppress colored output. 
 +  --no-python-version-warning 
 +                              Silence deprecation warnings for upcoming unsupported Pythons. 
 +  --use-feature &lt;feature>     Enable new functionality, that may be backward incompatible. 
 +  --use-deprecated &lt;feature>  Enable deprecated functionality, that will be removed in the future. 
 +</pre></html></WRAP>
 </WRAP> </WRAP>
  
-===== pip アップデート警告が出たら =====+===== コマンド補完 ===== 
 +参考: [[https://pip.pypa.io/en/stable/user_guide/#command-completion|User Guide#Command Completion - pip documentation v23.0.1]]\\ 
 +pip のコマンド補完が効いていない状態🤔\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> <b class=DiYE>-> Tab キーを押す</b> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +pip             pip-3.11        pip3.11         pipewire        pipewire-avb     
 +pip-3           pip3            pipetty         pipewire-aes67  pipewire-pulse 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +pip のコマンド補完を zsh に設定する🤔\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> pip completion <b class=HIK>--zsh</b> 
 +</pre></html></WRAP> 
 +<WRAP color_mincode><code bash> 
 + 
 +# pip zsh completion start 
 +function _pip_completion { 
 +  local words cword 
 +  read -Ac words 
 +  read -cn cword 
 +  reply=( $( COMP_WORDS="$words[*]"
 +             COMP_CWORD=$(( cword-1 )) \ 
 +             PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )) 
 +
 +compctl -K _pip_completion /usr/bin/python -m pip 
 +# pip zsh completion end 
 + 
 +</code></WRAP> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> pip completion <b class=HIK>--zsh</b> >> ~/.zprofile 
 +<b class=GRN>$</b> <b class=HIY>.</b> ~/.zprofile  
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +pip のコマンド補完を bash に設定する🤔\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> pip completion <b class=HIK>--bash</b> 
 +</pre></html></WRAP> 
 +<WRAP color_mincode><code bash> 
 + 
 +# pip bash completion start 
 +_pip_completion() 
 +
 +    COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}"
 +                   COMP_CWORD=$COMP_CWORD \ 
 +                   PIP_AUTO_COMPLETE=1 $1 2>/dev/null ) ) 
 +
 +complete -o default -F _pip_completion /usr/bin/python -m pip 
 +# pip bash completion end 
 + 
 +</code></WRAP> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> pip completion <b class=HIK>--bash</b> >> ~/.profile 
 +<b class=GRN>$</b> <b class=HIY>.</b> ~/.profile  
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +<html><code>"pip "</code></html>(pip のあとにスペースを1つ TAB キーを入力) pip のコマンド補完が効くようになる😍\\ 
 +zsh の場合\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<div class=BSc><b class=DKO>┌──(<b class="BOLD ORR">tomoyan  WICKED-BEAT</b>)-[</b>~<b style="color: darkorange">]</b> 
 +<b class=DKO>└─</b><b class=ORR>$</b> <b class=HIY>pip</b> <b class=DiYE>-> Tab キーを押す</b> 
 +</div>check      -- verify installed packages have compatible dependencies 
 +download   -- download packages 
 +freeze     -- output installed packages in requirements format 
 +hash       -- compute hashes of package archives 
 +help       -- show available commands 
 +install    -- install packages 
 +list       -- list installed packages 
 +search     -- search PyPI for packages 
 +show       -- show information about installed packages 
 +uninstall  -- uninstall packages 
 +wheel      -- build wheels from your requirements 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +bash の場合\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> <b class=DiYE>-> Tab キーを押す</b> 
 +cache       completion  debug       freeze      help        inspect     list        show        wheel 
 +check       config      download    hash        index       install     search      uninstall    
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +===== pip 自体のアップデート ===== 
 + 
 +==== システムにインストールされている pip が最新版ではない場合 ==== 
 + 
 +==== pip アップデート警告が出たら ====
 **pip install <package name>** の実行で以下の警告が表示されたら...\\ **pip install <package name>** の実行で以下の警告が表示されたら...\\
-<code+<WRAP color_term
-WARNING: You are using pip version 19.2.3, however version 20.0.2 is available. +<WRAP color_result><html><pre> 
-You should consider upgrading via the 'python -pip install --upgrade pip' command. +[<b class=HIB>notice</b>] A new release of pip available: <b class=RED>22.2.2</b> -> <b class=GRN>23.0.1</b> 
-</code>+[<b class=HIB>notice</b>] To update, run: <b class=GRN>pip install --upgrade pip</b> 
 +</pre></html></WRAP> 
 +</WRAP> 
 +<WRAP color_term> 
 +<WRAP color_result><html><pre> 
 +[<b class=HIB>お知らせ</b>] pip の新しいリリース: <b class=RED>22.2.2</b> -> <b class=GRN>23.0.1</b> 
 +[<b class=HIB>お知らせ</b>] 更新するには、次を実行します: <b class=GRN>pip install --upgrade pip</b> 
 +</pre></html></WRAP> 
 +</WRAP> 
 pip を更新する。\\ pip を更新する。\\
-<code+<WRAP color_term
-$ python -m pip install --upgrade pip+<WRAP color_command><html><pre> 
 +(pyMusicEnv) <b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> pip install <b class=HIK>-U</b> pip 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Requirement already satisfied: pip in ./pyMusicEnv/lib64/python3.11/site-packages (22.2.2)
 Collecting pip Collecting pip
-  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB) +  Using cached pip-23.0.1-py3-none-any.whl (2.MB)
-     |████████████████████████████████| 1.4MB 731kB/s+
 Installing collected packages: pip Installing collected packages: pip
-  Found existing installation: pip 19.2.3 +  Attempting uninstall: pip 
-    Uninstalling pip-19.2.3+    Found existing installation: pip 22.2.2 
-      Successfully uninstalled pip-19.2.3 +    Uninstalling pip-22.2.2
-Successfully installed pip-20.0.2 +      Successfully uninstalled pip-22.2.2 
-</code>+Successfully installed pip-23.0.1 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +===== パッケージの検索 ===== 
 +[[https://pypi.org/|PyPI · The Python Package Index]]\\ 
 + 
 +しばらく使えません...😥\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> search pandas 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +<b class=RED>ERROR: XMLRPC request failed [code: -32500] 
 +RuntimeError: PyPI no longer supports 'pip search' (or XML-RPC search). Please use https://pypi.org/search (via a browser) instead. See https://warehouse.pypa.io/api-reference/xml-rpc.html#deprecated-methods for more information.</b> 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +[[https://status.python.org/|Python Infrastructure Status]]\\ 
 +[[tw>PythonStatus|Python Statusさん (@PythonStatus) / Twitter]]\\
  
 ===== venv などの環境を複製 ===== ===== venv などの環境を複製 =====
 pip freeze の出力を保存する。 pip freeze の出力を保存する。
 <code> <code>
-$ pip freeze > pkglist.txt+$ pip freeze > requirements.txt
 </code> </code>
  
-pip install の引数に pkglist.txt を指定する。+pip install の引数に requirements.txt を指定する。
 <code> <code>
-$ pip install -r pkglist.txt+$ pip install -r requirements.txt
 </code> </code>
 +
 +===== パッケージ一覧 =====
 +
 +==== 古くなっているパッケージを表示 ====
 +<WRAP color_term>
 +<WRAP color_command><code>
 +$ pip list -o
 +</code></WRAP>
 +<WRAP color_result_long><code>
 +Package           Version   Latest    Type
 +----------------- --------- --------- -----
 +anyio             3.2.1     3.3.4     wheel
 +argon2-cffi       20.1.0    21.1.0    wheel
 +bleach            3.3.0     4.1.0     wheel
 +certifi           2021.5.30 2021.10.8 wheel
 +cffi              1.14.5    1.15.0    wheel
 +debugpy           1.3.0     1.5.0     wheel
 +decorator         5.0.9     5.1.0     wheel
 +GitPython         3.1.18    3.1.24    wheel
 +idna              2.10      3.3       wheel
 +ipykernel         6.0.1     6.4.1     wheel
 +ipython           7.25.0    7.28.0    wheel
 +Jinja2            3.0.1     3.0.2     wheel
 +jsonschema        3.2.0     4.1.0     wheel
 +jupyter-client    6.1.12    7.0.6     wheel
 +jupyter-core      4.7.1     4.8.1     wheel
 +jupyter-server    1.9.0     1.11.1    wheel
 +jupyterlab        3.0.16    3.2.0     wheel
 +jupyterlab-git    0.30.1    0.33.0    wheel
 +jupyterlab-server 2.6.0     2.8.2     wheel
 +kiwisolver        1.3.1     1.3.2     wheel
 +matplotlib        3.4.2     3.4.3     wheel
 +matplotlib-inline 0.1.2     0.1.3     wheel
 +nbclassic         0.3.1     0.3.2     wheel
 +nbclient          0.5.3     0.5.4     wheel
 +nbconvert         6.1.0     6.2.0     wheel
 +notebook          6.4.0     6.4.4     wheel
 +numpy             1.21.0    1.21.2    wheel
 +pandas            1.3.0     1.3.3     wheel
 +pandocfilters     1.4.3     1.5.0     wheel
 +Pillow            8.3.0     8.4.0     wheel
 +prompt-toolkit    3.0.19    3.0.20    wheel
 +Pygments          2.9.0     2.10.0    wheel
 +pyopencl          2021.2.6  2021.2.8  wheel
 +python-dateutil   2.8.1     2.8.2     wheel
 +pytools           2021.2.7  2021.2.8  sdist
 +pytz              2021.1    2021.3    wheel
 +pyzmq             22.1.0    22.3.0    wheel
 +requests          2.25.1    2.26.0    wheel
 +Send2Trash        1.7.1     1.8.0     wheel
 +setuptools        53.0.0    58.2.0    wheel
 +smmap             4.0.0     5.0.0     wheel
 +terminado         0.10.1    0.12.1    wheel
 +traitlets         5.0.5     5.1.0     wheel
 +urllib3           1.26.6    1.26.7    wheel
 +voila             0.2.10    0.2.16    wheel
 +websocket-client  1.1.0     1.2.1     wheel
 +</code></WRAP>
 +</WRAP>
 +
 +===== パッケージのインストールパスを調べる =====
 +
 +==== site パッケージについて ====
 +公式: [[https://docs.python.org/3/library/site.html|site — Site-specific configuration hook]] ([[https://docs-python-org.translate.goog/3/library/site.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> site
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +sys.path = [
 +    '/home/tomoyan',
 +    '/usr/lib64/python311.zip',
 +    '/usr/lib64/python3.11',
 +    '/usr/lib64/python3.11/lib-dynload',
 +    '/home/tomoyan/.local/lib/python3.11/site-packages',
 +    '/usr/lib64/python3.11/site-packages',
 +    '/usr/lib/python3.11/site-packages',
 +]
 +USER_BASE: '/home/tomoyan/.local' (exists)
 +USER_SITE: '/home/tomoyan/.local/lib/python3.11/site-packages' (exists)
 +ENABLE_USER_SITE: True
 +</pre></html></WRAP>
 +</WRAP>
 +
 +==== グローバル (Global) インストール ====
 +グローバル (Global) インストールの場合🤔\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-c</b> "import site; print('\n'.join(site.getsitepackages()))"
 +</pre></html></WRAP>
 +</WRAP>
 +
 +Python 2 系が共存しているシステムは無いと思うけど Python 3 を明示して実行する場合は <html><code>python3</code></html> を実行する🤔\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b class=HIY>python3</b> <b class=HIK>-c</b> "import site; print('\n'.join(site.getsitepackages()))"
 +</pre></html></WRAP>
 +</WRAP>
 +
 +**Fedora release 37 (Thirty Seven)**\\
 +<WRAP color_term>
 +<WRAP color_result><code>
 +/usr/local/lib64/python3.11/site-packages
 +/usr/local/lib/python3.11/site-packages
 +/usr/lib64/python3.11/site-packages
 +/usr/lib/python3.11/site-packages
 +</code></WRAP>
 +</WRAP>
 +
 +**Raspbian GNU/Linux 10 (buster)**\\
 +<WRAP color_term>
 +<WRAP color_result><code>
 +/usr/local/lib/python3.7/dist-packages
 +/usr/lib/python3/dist-packages
 +/usr/lib/python3.7/dist-packages
 +</code></WRAP>
 +</WRAP>
 +
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b class=HIY>pip</b> show mercurial
 +</pre></html></WRAP>
 +<WRAP color_result><code>
 +Name: mercurial
 +Version: 5.6.1
 +Summary: Fast scalable distributed SCM (revision control, version control) system
 +Home-page: https://mercurial-scm.org/
 +Author: Matt Mackall and many others
 +Author-email: mercurial@mercurial-scm.org
 +License: GNU GPLv2 or any later version
 +Location: /usr/local/lib/python3.7/dist-packages
 +Requires:
 +Required-by:
 +</code></WRAP>
 +</WRAP>
 +パッケージは **Location:** /usr/local/lib/python3.7/dist-packages にインストールされている。\\
 +
 +==== Debian 系では site-packages ではなくdist-packages ====
 +Debian パッケージからインストールされたサードパーティの Python ソフトウェアは、site-packages ではなく dist-packages に入ります。\\
 +[[https://wiki.debian.org/Python#Deviations_from_upstream|Deviations from upstream | Python - Debian Wiki]] より\\
 +
 +**付録**\\
 +[[tw>tomoyan596/status/1392544477613461504|$ python3 -c "import site; print('\n'.join(site.getsitepackages()))" / Twitter]]\\
 +[[tw>tomoyan596/status/1399598883949322240|WindowsのPythonのvenvモジュールが、仮想環境にpython3コマンドを用意してくれないのは何故でしょうねぇ🤔LinuxとWindowsを行き来して開発していると、WindowsのPython仮想環境でpython3コマンドを使うと、全然違うsite-packagesを見てハマりますねぇ🤔 仮想環境に入ったらpythonコマンドの癖つけよう」 / Twitter]]\\
  
 ===== pip のダウンロードキャッシュ ===== ===== pip のダウンロードキャッシュ =====
-キャッシュをクリアしなくても以下の **--no-cache-dir** オプションでキャッシュを利用しなくなる。\\+キャッシュをクリアしなくても以下の <html><code>--no-cache-dir</code></html> オプションでキャッシュを利用しなくなる。\\
 <code> <code>
 $ pip install django --no-cache-dir $ pip install django --no-cache-dir
行 75: 行 471:
 ~/.cache/pip ~/.cache/pip
 </code> </code>
 +
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<span style="color:#FF8700"><b>$</b></span> <span style="color:#26A269">pip3</span> cache info
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +Package index page cache location: /home/tomoyan/.cache/pip/http
 +Package index page cache size: 905.6 MB
 +Number of HTTP files: 976
 +Locally built wheels location: /home/tomoyan/.cache/pip/wheels
 +Locally built wheels size: 482 kB
 +Number of locally built wheels: 4
 +</pre></html></WRAP>
 +</WRAP>
  
 ==== Mac ==== ==== Mac ====
行 90: 行 500:
 以下は pip パッケージを利用した HTTP URL のダウンローダーのコードである。\\ 以下は pip パッケージを利用した HTTP URL のダウンローダーのコードである。\\
 この **download_http_url()** 関数を利用すれば、パッケージではない様々なファイルを pip と同様に進行状況を表示しながらダウンロードする事ができる。\\ この **download_http_url()** 関数を利用すれば、パッケージではない様々なファイルを pip と同様に進行状況を表示しながらダウンロードする事ができる。\\
-\\  +<WRAP color_term
-<WRAP prewrap 100%+<WRAP color_mincode_long><code python pip_downloader.py>
-<file python pip_downloader.py>+
 #!/usr/bin/env python3 #!/usr/bin/env python3
 # -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
行 244: 行 653:
         _download_url(resp, link, content_file, hashes, progress_bar)         _download_url(resp, link, content_file, hashes, progress_bar)
     return file_path, content_type     return file_path, content_type
-</file>+</code></WRAP>
 </WRAP> </WRAP>
 pip_downloader.py の使い方。\\ pip_downloader.py の使い方。\\
-<WRAP prewrap 100%+<WRAP color_term
-<file python main.py>+<WRAP color_mincode><file python main.py>
 #!/usr/bin/env python3 #!/usr/bin/env python3
 ## -*- coding: utf-8 -*- ## -*- coding: utf-8 -*-
行 265: 行 674:
 if __name__ == "__main__": if __name__ == "__main__":
     main()     main()
-</file>+</file></WRAP>
 </WRAP> </WRAP>
 main.py 実行する。\\ main.py 実行する。\\
-<WRAP prewrap 100%+<WRAP color_term
-<code>+<WRAP color_command><code>
 > python main.py > python main.py
 +</code></WRAP>
 +<WRAP color_result><code>
 Downloading https://download.visualstudio.microsoft.com/download/pr/7b196ac4-65a9-4fde-b720-09b5339dbaba/78df39539625fa4e6c781c6a2aca7b4f/vs_community.exe (1.3MB) Downloading https://download.visualstudio.microsoft.com/download/pr/7b196ac4-65a9-4fde-b720-09b5339dbaba/78df39539625fa4e6c781c6a2aca7b4f/vs_community.exe (1.3MB)
 Downloading from URL https://download.visualstudio.microsoft.com/download/pr/7b196ac4-65a9-4fde-b720-09b5339dbaba/78df39539625fa4e6c781c6a2aca7b4f/vs_community.exe Downloading from URL https://download.visualstudio.microsoft.com/download/pr/7b196ac4-65a9-4fde-b720-09b5339dbaba/78df39539625fa4e6c781c6a2aca7b4f/vs_community.exe
    |████████████████████████████████| 1.4MB 3.3MB/s    |████████████████████████████████| 1.4MB 3.3MB/s
-</code>+</code></WRAP> 
 +</WRAP> 
 + 
 +===== トラブルシューティング ===== 
 + 
 +==== ある日突然 pip が壊れた😅💦 ==== 
 +システムの Python バージョンがマイナーアップデートした事による影響も考えられるので、以下の文献も参照のこと🤔\\ 
 +[[python:venv#仮想環境で ModuleNotFoundError: No module named 'pip' が発生する😇|仮想環境で ModuleNotFoundError: No module named 'pip' が発生する😇]]\\ 
 +\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>.</b> pyJupyterLab/bin/activate 
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>pip</b> install <b class=HIK>-U</b> jupyterlab 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Traceback (most recent call last): 
 +  File "/home/tomoyan/pyJupyterLab/bin/pip", line 5, in &lt;module> 
 +    from pip._internal.cli.main import main 
 +ModuleNotFoundError: No module named 'pip' 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +[[https://bootstrap.pypa.io/get-pip.py|]] で再インストールして治す🤤\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>curl</b> <b class=HIK>-sS</b> https://bootstrap.pypa.io/get-pip.py | python 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Collecting pip 
 +  Downloading pip-22.1-py3-none-any.whl (2.1 MB) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>2.1/2.1 MB</b> <b class=RED>3.1 MB/s</b> eta <b class=CYN>0:00:00</b> 
 +Collecting setuptools 
 +  Downloading setuptools-62.3.2-py3-none-any.whl (1.2 MB) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>1.2/1.2 MB</b> <b class=RED>11.4 MB/s</b> eta <b class=CYN>0:00:00</b> 
 +Collecting wheel 
 +  Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB) 
 +Installing collected packages: wheel, setuptools, pip 
 +Successfully installed pip-22.1 setuptools-62.3.2 wheel-0.37.1 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +または、<html><code>ensurepip</code></html> を実行する。\\ 
 +公式: [[https://packaging.python.org/ja/latest/tutorials/installing-packages/#ensure-you-can-run-pip-from-the-command-line|コマンドラインから pip を実行できることを確実にする - パッケージをインストールする — Python Packaging User Guide]]\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>python3</b> <b class=HIK>-m</b> ensurepip <b class=HIK>--default-pip</b> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>pip</b> 
 +</pre></html></WRAP> 
 +<WRAP color_result_long><html><pre> 
 + 
 +Usage:    
 +  pip &lt;command> [options] 
 + 
 +Commands: 
 +  install                     Install packages. 
 +  download                    Download packages. 
 +  uninstall                   Uninstall packages. 
 +  freeze                      Output installed packages in requirements format. 
 +  inspect                     Inspect the python environment. 
 +  list                        List installed packages. 
 +  show                        Show information about installed packages. 
 +  check                       Verify installed packages have compatible dependencies. 
 +  config                      Manage local and global configuration. 
 +  search                      Search PyPI for packages. 
 +  cache                       Inspect and manage pip's wheel cache. 
 +  index                       Inspect information available from package indexes. 
 +  wheel                       Build wheels from your requirements. 
 +  hash                        Compute hashes of package archives. 
 +  completion                  A helper command used for command completion. 
 +  debug                       Show information useful for debugging. 
 +  help                        Show help for commands. 
 + 
 +General Options: 
 +  -h, --help                  Show help. 
 +  --debug                     Let unhandled exceptions propagate outside the main subroutine, instead of 
 +                              logging them to stderr. 
 +  --isolated                  Run pip in an isolated mode, ignoring environment variables and user 
 +                              configuration. 
 +  --require-virtualenv        Allow pip to only run in a virtual environment; exit with an error otherwise. 
 +  --python &lt;python>           Run pip with the specified Python interpreter. 
 +  -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. Option is additive, and can be used up to 3 times 
 +                              (corresponding to WARNING, ERROR, and CRITICAL logging levels). 
 +  --log &lt;path>                Path to a verbose appending log. 
 +  --no-input                  Disable prompting for input. 
 +  --proxy &lt;proxy>             Specify a proxy in the form scheme://[user:passwd@]proxy.server:port. 
 +  --retries &lt;retries>         Maximum number of retries each connection should attempt (default 5 times). 
 +  --timeout &lt;sec>             Set the socket timeout (default 15 seconds). 
 +  --exists-action &lt;action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, 
 +                              (b)ackup, (a)bort. 
 +  --trusted-host &lt;hostname>   Mark this host or host:port pair as trusted, even though it does not have 
 +                              valid or any HTTPS. 
 +  --cert &lt;path>               Path to PEM-encoded CA certificate bundle. If provided, overrides the default. 
 +                              See 'SSL Certificate Verification' in pip documentation for more information. 
 +  --client-cert &lt;path>        Path to SSL client certificate, a single file containing the private key and 
 +                              the certificate in PEM format. 
 +  --cache-dir &lt;dir>           Store the cache data in &lt;dir>
 +  --no-cache-dir              Disable the cache. 
 +  --disable-pip-version-check 
 +                              Don't periodically check PyPI to determine whether a new version of pip is 
 +                              available for download. Implied with --no-index. 
 +  --no-color                  Suppress colored output. 
 +  --no-python-version-warning 
 +                              Silence deprecation warnings for upcoming unsupported Pythons. 
 +  --use-feature &lt;feature>     Enable new functionality, that may be backward incompatible. 
 +  --use-deprecated &lt;feature>  Enable deprecated functionality, that will be removed in the future. 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +==== pip list -o/--outdated が失敗する ==== 
 +古いパッケージの一覧表示が失敗する。\\ 
 +<WRAP color_term 100%> 
 +<WRAP color_command><code> 
 +$ python3 -m pip list -o 
 +</code></WRAP> 
 +<WRAP color_result><html><pre> 
 +<b class=RED>Exception: 
 +Traceback (most recent call last): 
 +  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 143, in main 
 +    status = self.run(options, args) 
 +  File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 138, in run 
 +    packages = self.get_outdated(packages, options) 
 +  File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 149, in get_outdated 
 +    dist for dist in self.iter_packages_latest_infos(packages, options) 
 +  File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 150, in &lt;listcomp&gt; 
 +    if dist.latest_version &gt; dist.parsed_version 
 +TypeError: '&gt;' not supported between instances of 'Version' and 'Version'</b> 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +=== ディストリビューションの pip を最新版に更新する場合 === 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">python3</font> <font color="#A347BA">-m</font> pip <font color="#A347BA">-V</font> 
 +</pre></html></WRAP> 
 +<WRAP color_result><code> 
 +pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7) 
 +</code></WRAP> 
 +</WRAP> 
 + 
 +ディストリビューションの古い **python3-pip** パッケージだと不具合がある。\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">python3</font> <font color="#A347BA">-m</font> pip list <font color="#A347BA">-v</font> 
 +</pre></html></WRAP> 
 +<WRAP color_result><code> 
 +Package    Version Location                       Installer 
 +---------- ------- ------------------------------ --------- 
 +pip        18.1    /usr/lib/python3/dist-packages 
 +setuptools 40.8.0  /usr/lib/python3/dist-packages 
 +</code></WRAP> 
 +</WRAP> 
 + 
 +pip を最新版に更新する。\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">python3</font> <font color="#A347BA">-m</font> pip install <font color="#A347BA">-U</font> pip 
 +</pre></html></WRAP> 
 +<WRAP color_result><code> 
 +Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple 
 +Collecting pip 
 +  Downloading https://files.pythonhosted.org/packages/cd/6f/43037c7bcc8bd8ba7c9074256b1a11596daa15555808ec748048c1507f08/pip-21.1.1-py3-none-any.whl (1.5MB) 
 +    100% |████████████████████████████████| 1.6MB 34kB/s 
 +Installing collected packages: pip 
 +Successfully installed pip-21.1.1 
 +</code></WRAP> 
 +</WRAP> 
 + 
 +**pip list -o** が正常に利用できることを確認する。\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">python3</font> <font color="#A347BA">-m</font> pip install <font color="#A347BA">-U</font> pip 
 +</pre></html></WRAP> 
 +<WRAP color_result><code> 
 +Package    Version Latest Type 
 +---------- ------- ------ ----- 
 +setuptools 40.8.0  56.2.0 wheel 
 +</code></WRAP> 
 +</WRAP> 
 + 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">python3</font> <font color="#A347BA">-m</font> pip list <font color="#A347BA">-v</font> 
 +</pre></html></WRAP> 
 +<WRAP color_result><code> 
 +Package    Version Location                                         Installer 
 +---------- ------- ------------------------------------------------ --------- 
 +pip        21.1.1  /home/tomoyan/.local/lib/python3.7/site-packages pip 
 +setuptools 40.8.0  /usr/lib/python3/dist-packages 
 +</code></WRAP> 
 +</WRAP> 
 + 
 +=== 仮想環境の pip を最新版に更新する場合 === 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(py3_venv) <font color="#FF8700"><b>$</b></font> <font color="#26A269">pip</font> <font color="#A347BA">-V</font> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +pip 18.1 from /home/tomoyan/py3_venv/lib/python3.7/site-packages/pip (python 3.7) 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +pip を最新版に更新する。\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(py3_venv) <font color="#FF8700"><b>$</b></font> <font color="#26A269">python</font> <font color="#A347BA">-m</font> pip install <font color="#A347BA">-U</font> pip 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple 
 +Collecting pip 
 +  Downloading https://files.pythonhosted.org/packages/cd/6f/43037c7bcc8bd8ba7c9074256b1a11596daa15555808ec748048c1507f08/pip-21.1.1-py3-none-any.whl (1.5MB) 
 +    100% |████████████████████████████████| 1.6MB 40kB/s 
 +Installing collected packages: pip 
 +  Found existing installation: pip 18.1 
 +    Uninstalling pip-18.1: 
 +      Successfully uninstalled pip-18.1 
 +Successfully installed pip-21.1.1 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +更新後のバージョン確認。\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(py3_venv) <font color="#FF8700"><b>$</b></font> <font color="#26A269">pip</font> <font color="#A347BA">-V</font> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +pip 21.1.1 from /home/tomoyan/py3_venv/lib/python3.7/site-packages/pip (python 3.7) 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +**pip list -o** が正常に利用できることを確認する。\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">pip</font> list <font color="#A347BA">-o</font> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Package    Version  Latest    Type 
 +---------- -------- --------- ----- 
 +Django     3.2.1    3.2.3     wheel 
 +pytz       2020.4   2021.1    wheel 
 +setuptools 40.8.0   56.2.0    wheel 
 +supervisor 4.2.1    4.2.2     wheel 
 +youtube-dl 2021.1.8 2021.4.26 wheel 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +==== システムの古い pip ラッパー📯が新しい pip モジュールを実行してしまう場合🤔 ==== 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">pip</font> <font color="#A347BA">-V</font> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. 
 +Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. 
 +To avoid this problem you can invoke Python with &apos;-m pip&apos; instead of running pip directly. 
 +pip 24.0 from /home/tomoyan/.local/lib/python3.12/site-packages/pip (python 3.12) 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +警告: pip は古いスクリプト ラッパーによって呼び出されています。これは、pip の将来のバージョンでは失敗します。 
 +根本的な問題を修正するためのアドバイスについては、https://github.com/pypa/pip/issues/5599 を参照してください。 
 +この問題を回避するには、pip を直接実行する代わりに、「-m pip」を使用して Python を呼び出すことができます。 
 +/home/tomoyan/.local/lib/python3.12/site-packages/pip からの pip 24.0 (Python 3.12) 
 +</pre></html></WRAP> 
 +</WRAP> 
 +[[git>pypa/pip/issues/5599|ImportError in system pip wrappers after an upgrade · Issue #5599 · pypa/pip · GitHub]]\\ 
 + 
 +回避方法その1: pip のモジュールを直接実行する。\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">python</font> <font color="#A347BA">-m</font> pip <font color="#A347BA">-V</font> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +pip 24.0 from /home/tomoyan/.local/lib/python3.12/site-packages/pip (python 3.12) 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +解決の糸口😅\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#FF8700"><b>$</b></font> <font color="#26A269">which</font> pip <font color="#12488B"><b>&amp;&amp;</b></font> <font color="#26A269">python</font> <font color="#A347BA">-s</font> <font color="#A347BA">-m</font> pip <font color="#A347BA">-V</font> <font color="#12488B"><b>&amp;&amp;</b></font> <font color="#26A269">python</font> <font color="#A347BA">-m</font> pip <font color="#A347BA">-V</font> <font color="#12488B"><b>&amp;&amp;</b></font> <font color="#26A269">echo</font> <font color="#A2734C">&apos;---- ✂  ----&apos;</font> <font color="#12488B"><b>&amp;&amp;</b></font> <font color="#26A269">echo</font> $PATH <font color="#12488B"><b>|</b></font> <font color="#26A269">grep</font>
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +/usr/local/bin/pip 
 +pip 23.2.1 from /usr/lib/python3.12/site-packages/pip (python 3.12) 
 +pip 24.0 from /home/tomoyan/.local/lib/python3.12/site-packages/pip (python 3.12) 
 +---- ✂  ---- 
 +/home/tomoyan/miniforge3/condabin<font color="#C01C28"><b>:</b></font>/home/tomoyan/micromamba/bin<font color="#C01C28"><b>:</b></font>/home/tomoyan/.cargo/bin<font color="#C01C28"><b>:</b></font>/home/tomoyan/.anyenv/envs/nodenv/shims<font color="#C01C28"><b>:</b></font>/home/tomoyan/.anyenv/envs/nodenv/bin<font color="#C01C28"><b>:</b></font>/home/tomoyan/.anyenv/bin<font color="#C01C28"><b>:</b></font>/usr/local/bin<font color="#C01C28"><b>:</b></font>/usr/bin<font color="#C01C28"><b>:</b></font>/usr/local/sbin<font color="#C01C28"><b>:</b></font>/usr/sbin<font color="#C01C28"><b>:</b></font>/home/tomoyan/.local/bin<font color="#C01C28"><b>:</b></font>/home/tomoyan/.local/bin 
 +</pre></html></WRAP>
 </WRAP> </WRAP>
  
 ===== 参考文献 ===== ===== 参考文献 =====
 +[[https://roman.pt/posts/optimize-pip-install-with-wheels/|Optimize pip install with wheels - Roman Imankulov]] [[gtr>https://roman.pt/posts/optimize-pip-install-with-wheels/|翻訳]]\\
 +[[https://pip.pypa.io/en/stable/|Home - pip documentation v21.1.1]]\\
 [[http://d.hatena.ne.jp/rudi/20110107/1294409385|pipの使い方 - そこはかとなく書くよ。]]\\ [[http://d.hatena.ne.jp/rudi/20110107/1294409385|pipの使い方 - そこはかとなく書くよ。]]\\
 +[[http://tdoc.info/blog/2014/01/15/pip.html|pipの使い方 (2014/1バージョン) — そこはかとなく書くよん。]]\\
 +[[https://www.task-notes.com/entry/20150810/1439175600|【Python】pipの使い方 - TASK NOTES]]\\
 +[[qita>kazushisan/items/183bdeaddf9629a2f21d|pipで更新可能なパッケージを一括でアップデートする - Qiita]]\\
 +[[git>pypa/pip/issues/5599|ImportError in system pip wrappers after an upgrade · Issue #5599 · pypa/pip · GitHub]]\\
 +[[https://www.python.org/dev/peps/pep-0397/|PEP 397 -- Python launcher for Windows | Python.org]]\\
 +[[https://docs.python.org/ja/3/library/site.html|site --- サイト固有の設定フック — Python 3.9.4 ドキュメント]]\\
 +[[so>questions/70252345/getting-modulenotfounderror-no-module-named-pip-while-inside-of-venv|Getting "ModuleNotFoundError: No module named 'pip'" while inside of venv]]\\
 +[[so>questions/4888027/python-and-pip-list-all-versions-of-a-package-thats-available|Python and pip, list all versions of a package that's available?]]\\
 +[[rtd>kurozumi.github.io/pip/user_guide.html|ユーザーガイド — pip 9.1.0.dev0 ドキュメント]]\\
 +[[https://packaging.python.org/en/latest/tutorials/installing-packages/|Installing Packages — Python Packaging User Guide]] [[gtr>https://packaging.python.org/en/latest/tutorials/installing-packages/|翻訳]]\\
  • python/pip.1580417190.txt.gz
  • 最終更新: 2020/01/31 05:46
  • by ともやん