venvでPythonの仮想環境
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
* venvでPythonの仮想環境 [#x8124bac]
Python 3.3 から標準機能になった venv を使えば、手順は簡単。
$ python3 -m venv <DIR>
$ source <DIR>/bin/activate
実際に jupyter notebook をインストールする時はこんな感じ
$ mkdir jupyter
$ cd jupyter
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install jupyter numpy
起動
$ jupyter notebook
実に簡単にできる。
** venvの導入 [#u2f589ad]
下記のように Python 3.3 より以前の場合は
$ python3 --version
Python 3.13.5
$ sudo apt install python3.13-venv
でvenvを導入する。
** 仮想環境(venv)をログイン時に有効化する [#jb6bed80]
仮想環境(venv)をログイン時に有効化したい場合はこんな感...
ユーザー用ディレクトリに仮想環境を作成
$ python3 -m venv ~/.venvs/default
~/.bashrc の末尾に追記
$ echo 'source ~/.venvs/default/bin/activate' >> ~/.bashrc
$ source ~/.bashrc
~
#htmlinsert(amazon_pc.html);
終了行:
* venvでPythonの仮想環境 [#x8124bac]
Python 3.3 から標準機能になった venv を使えば、手順は簡単。
$ python3 -m venv <DIR>
$ source <DIR>/bin/activate
実際に jupyter notebook をインストールする時はこんな感じ
$ mkdir jupyter
$ cd jupyter
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install jupyter numpy
起動
$ jupyter notebook
実に簡単にできる。
** venvの導入 [#u2f589ad]
下記のように Python 3.3 より以前の場合は
$ python3 --version
Python 3.13.5
$ sudo apt install python3.13-venv
でvenvを導入する。
** 仮想環境(venv)をログイン時に有効化する [#jb6bed80]
仮想環境(venv)をログイン時に有効化したい場合はこんな感...
ユーザー用ディレクトリに仮想環境を作成
$ python3 -m venv ~/.venvs/default
~/.bashrc の末尾に追記
$ echo 'source ~/.venvs/default/bin/activate' >> ~/.bashrc
$ source ~/.bashrc
~
#htmlinsert(amazon_pc.html);
ページ名: