差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
| python:venv [2019/08/15 11:24] – ともやん | python:venv [2023/03/08 19:50] (現在) – ともやん | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | <ifauth !@loggedinusers>< | ||
| - | <script async src="// | ||
| - | < | ||
| - |  | ||
| - | google_ad_client: | ||
| - | enable_page_level_ads: | ||
| - | }); | ||
| - | </ | ||
| - | < | ||
| - | < | ||
| - | #result pre { | ||
| - | height: 200px; | ||
| - | overflow: scroll; | ||
| - | overflow-x: hidden; | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| ====== Python venv 仮想環境 ====== | ====== Python venv 仮想環境 ====== | ||
| 行 21: | 行 4: | ||
| ==== Linux ==== | ==== Linux ==== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ python -m venv py37 | + | <WRAP color_command>< | 
| - | </code> | + | <b class=GRN> | 
| + | </pre></ | ||
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </ | ||
| + | ^py38^^^| 仮想環境フォルダ | ||
| + | | + ^include^^^^ | ||
| + | | + ^lib^^^^ | ||
| + | | + ^lib64 -> lib^^^^ | ||
| + | |%%|%%| + ^python3.8^^^ | ||
| + | |%%|%%|%%|%%| + ^site-packages| 仮想環境のパッケージ | ||
| + | | + ^bin^^^^ | ||
| + | |%%|%%| + |activate|| 仮想環境を有効化 (bash) | ||
| + | |%%|%%| + |activate.csh|| 仮想環境を有効化 (C shell) | ||
| + | |%%|%%| + |activate.fish|| 仮想環境を有効化 (fish shell) | ||
| + | |%%|%%| + |pip|| pip コマンド | ||
| + | |%%|%%| + |pip3|| ::: | | ||
| + | |%%|%%| + |pip3.8|| ::: | | ||
| + | |%%|%%| + |python|| python コマンド | ||
| + | |%%|%%| + |python3|| ::: | | ||
| ==== Windows ==== | ==== Windows ==== | ||
| - | <code> | + | <WRAP color_term> | 
| - | > python -m venv py37 | + | <WRAP color_command>< | 
| - | </code> | + | <b class=GRN>></ | 
| - | ^py37^^| 仮想環境フォルダ | + | </ | 
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </WRAP> | ||
| + | ^py38^^| 仮想環境フォルダ | ||
| | + ^Include^^^ | | + ^Include^^^ | ||
| | + ^Lib^^^ | | + ^Lib^^^ | ||
| 行 44: | 行 50: | ||
| ==== Linux ==== | ==== Linux ==== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ py37/ | + | <WRAP color_command>< | 
| - | (py37) $ | + | <b class=GRN> | 
| - | </code> | + | (py38) <b class=GRN> | 
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </ | ||
| + | または | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | <b class=GRN> | ||
| + | (py38) <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </WRAP> | ||
| ==== Windows ==== | ==== Windows ==== | ||
| - | <code> | + | <WRAP color_term> | 
| - | > py37\Scripts\activate | + | <WRAP color_command>< | 
| - | (py37) > | + | <b class=GRN>></ | 
| - | </code> | + | (py38) <b class=GRN>></ | 
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== 仮想環境の pip を更新 ===== | ||
| + | |||
| + | ==== Linux ==== | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | (py38) <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </ | ||
| + | または | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | (py38) <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ==== Windows ==== | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | (py38) <b class=GRN>></ | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </ | ||
| + | または | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | (py38) <b class=GRN>></ | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </WRAP> | ||
| ===== 仮想環境の終了 ===== | ===== 仮想環境の終了 ===== | ||
| + | |||
| ==== Linux ==== | ==== Linux ==== | ||
| - | <code> | + | <WRAP color_term> | 
| - | (py37) $ deactivate | + | <WRAP color_command>< | 
| - | $ | + | (py38) <b class=GRN> | 
| - | </code> | + | </ | 
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </WRAP> | ||
| ==== Windows ==== | ==== Windows ==== | ||
| - | <code> | + | <WRAP color_term> | 
| - | (py37) > deactivate | + | <WRAP color_command>< | 
| - | > | + | (py38) <b class=GRN>></ | 
| - | </code> | + | </ | 
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== トラブルシューティング ===== | ||
| + | |||
| + | ==== 仮想環境で ModuleNotFoundError: | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | (pyJupyterLab) <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | Traceback (most recent call last): | ||
| + | File "/ | ||
| + | from pip._internal.cli.main import main | ||
| + | ModuleNotFoundError: | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Python 3.10.6 で作った仮想環境だが、現在の Python バージョンは 3.11.1 である😢\\ | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | (pyJupyterLab) <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | home = /usr/bin | ||
| + | include-system-site-packages = false | ||
| + | version = 3.10.6 | ||
| + | </ | ||
| + | <WRAP color_command>< | ||
| + | (pyJupyterLab) <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | Python 3.11.1 | ||
| + | </ | ||
| + | </WRAP> | ||
| + | < | ||
| + | これで一先ず動作するが、何か影響が出る可能性もあるかも...😅\\ | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | (pyJupyterLab) <b class=GRN> | ||
| + | (pyJupyterLab) <b class=GRN> | ||
| + | (pyJupyterLab) <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | 合計 4 | ||
| + | drwxr-xr-x 1 tomoyan tomoyan 26 5月 21 2022 python3.10 | ||
| + | lrwxrwxrwx 1 tomoyan tomoyan 11 2月 10 12:28 python3.11 -> python3.10/ | ||
| + | drwxr-xr-x 1 tomoyan tomoyan 26 7月 6 2021 python3.9 | ||
| + | </ | ||
| + | <WRAP color_command>< | ||
| + | (pyJupyterLab) <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | aiohttp==3.8.1 | ||
| + | aiosignal==1.2.0 | ||
| + | anyio==3.6.1 | ||
| + | ... | ||
| + | </ | ||
| + | </ | ||
