LoginSignup
101
68

More than 5 years have passed since last update.

jupyter notebookでvenvを使う

Last updated at Posted at 2018-08-04

割と最近仮想環境の重要性に気づいて、venvを使うようになったんですが、jupyter notebookを起動してみたところ、venvが適用されてない!
適用方法を調べてみたら意外と簡単だったので、メモしておきます。
こちらの記事を参考にしました。

Jupyter notebook on venv!

まず仮想環境を作って、activateします。

$ python -m venv projectname
$ source projectname/bin/activate

次に仮想環境上でipykernelをインストールします。

(projectname)$ pip install ipykernel

その後jupyterにカーネルを追加します。

(projectname)$ ipython kernel install --user --name=projectname

これでjupyter notebookを開くと、KernelタブのChenge kernelメニューにprojectnameが追加されていると思うので、それを選択すればOKです!

101
68
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
101
68