python:venv

差分

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

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
python:venv [2020/04/06 08:33] – [Linux] ともやんpython:venv [2023/03/08 19:50] (現在) ともやん
行 1: 行 1:
-<html> 
-  <style> 
-    #result pre { 
-      height: 200px; 
-      overflow: scroll; 
-      overflow-x: hidden; 
-    } 
-  </style> 
-</html> 
 ====== Python venv 仮想環境 ====== ====== Python venv 仮想環境 ======
  
行 13: 行 4:
  
 ==== Linux ==== ==== Linux ====
-<code+<WRAP color_term
-$ python -m venv py38 +<WRAP color_command><html><pre> 
-</code>+<b class=GRN>$</b> <b class=HIY>python</b> <b class=HIK>-m</b> venv py38 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP> 
 +</WRAP>
 ^py38^^^| 仮想環境フォルダ  | ^py38^^^| 仮想環境フォルダ  |
 | + ^include^^^^ | + ^include^^^^
行 33: 行 28:
  
 ==== Windows ==== ==== Windows ====
-<code+<WRAP color_term
-> python -m venv py38 +<WRAP color_command><html><pre> 
-</code>+<b class=GRN>></b> <b class=HIY>python</b> <b class=HIK>-m</b> venv py38 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP> 
 +</WRAP>
 ^py38^^| 仮想環境フォルダ  | ^py38^^| 仮想環境フォルダ  |
 | + ^Include^^^ | + ^Include^^^
行 51: 行 50:
  
 ==== Linux ==== ==== Linux ====
-<code+<WRAP color_term
-source py38/bin/activate +<WRAP color_command><html><pre> 
-(py38) $ +<b class=GRN>$</b> <b class=HIY>.</b> py38/bin/activate 
-</code>+(py38) <b class=GRN>$</b> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP> 
 +</WRAP>
 または または
-<code+<WRAP color_term
-py38/bin/activate +<WRAP color_command><html><pre> 
-(py38) $ +<b class=GRN>$</b> <b class=HIY>source</b> py38/bin/activate 
-</code>+(py38) <b class=GRN>$</b> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ==== Windows ==== ==== Windows ====
-<code+<WRAP color_term
-> py38\Scripts\activate +<WRAP color_command><html><pre> 
-(py38) > +<b class=GRN>></b> py38/bin/activate 
-</code>+(py38) <b class=GRN>></b> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP
 +</WRAP>
  
 ===== 仮想環境の pip を更新 ===== ===== 仮想環境の pip を更新 =====
  
 ==== Linux ==== ==== Linux ====
-<code+<WRAP color_term> 
-(py38) $ python -m pip install --upgrade pip +<WRAP color_command><html><pre
-</code>+(py38) <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> 
 +</pre></html></WRAP> 
 +</WRAP> 
 +または 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(py38) <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> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ==== Windows ==== ==== Windows ====
-<code+<WRAP color_term> 
-(py38) > python -m pip install --upgrade pip +<WRAP color_command><html><pre
-+(py38) <b class=GRN>></b> <b class=HIY>python</b> <b class=HIK>-m</b> pip install <b class=HIK>-U</b> pip 
-</code>+</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP> 
 +</WRAP> 
 +または 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(py38) <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> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP
 +</WRAP>
  
 ===== 仮想環境の終了 ===== ===== 仮想環境の終了 =====
  
 ==== Linux ==== ==== Linux ====
-<code+<WRAP color_term> 
-(py38) $ deactivate +<WRAP color_command><html><pre
-$ +(py38) <b class=GRN>$</b> <b class=HIY>deactivate</b> 
-</code>+</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ==== Windows ==== ==== Windows ====
-<code+<WRAP color_term> 
-(py38) > deactivate +<WRAP color_command><html><pre
-+(py38) <b class=GRN>></b> <b class=HIY>deactivate</b> 
-</code>+</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +===== トラブルシューティング ===== 
 + 
 +==== 仮想環境で ModuleNotFoundError: No module named 'pip' が発生する😇 ==== 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>pip</b> freeze 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Traceback (most recent call last): 
 +  File "/home/tomoyan/pyJupyterLab/bin/pip", line 5, in <module> 
 +    from pip._internal.cli.main import main 
 +ModuleNotFoundError: No module named 'pip' 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +Python 3.10.6 で作った仮想環境だが、現在の Python バージョンは 3.11.1 である😢\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>cat</b> pyvenv.cfg  
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +home = /usr/bin 
 +include-system-site-packages = false 
 +version = 3.10.6 
 +</pre></html></WRAP> 
 +<WRAP color_command><html><pre> 
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>python</b> -V 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Python 3.11.1 
 +</pre></html></WRAP
 +</WRAP>
  
 +<venv>/lib で python3.11 -> python3.10/ のシンボルリンクを作成してみる🤔\\
 +これで一先ず動作するが、何か影響が出る可能性もあるかも...😅\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>cd</b> lib
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>ln</b> <b class=HIK>-s</b> python3.10/ python3.11
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>ll</b>
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +合計 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
 +</pre></html></WRAP>
 +<WRAP color_command><html><pre>
 +(pyJupyterLab) <b class=GRN>$</b> <b class=HIY>pip</b> freeze
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +aiohttp==3.8.1
 +aiosignal==1.2.0
 +anyio==3.6.1
 +...
 +</pre></html></WRAP>
 +</WRAP>
  
  • python/venv.1586129622.txt.gz
  • 最終更新: 2020/04/06 08:33
  • by ともやん