LoginSignup
0
2

More than 1 year has passed since last update.

Jupyter Notebook上でkernelを追加したり削除したりする方法

Posted at

おおきな流れ

  1. condaに仮想環境を作る
  2. 仮想環境にパッケージインストール
  3. ipykernelをインストール
  4. jupyter notebookに1で作成した仮想環境を追加
  5. 不必要なkernelを削除

condaに仮想環境を作る

以下のコマンドで仮想環境を作成
*hogeの部分は好きな名前に変更してください。pythonのversionは適当に変更してください

conda create -n hoge python=3.7

仮想環境を作成されているか確認

conda info -e

仮想環境にパッケージインストール

作成した仮想環境をアクティベートする

conda activate hoge

例としてpytorchをインストール

conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch

pytorchがインストールされているかを確認

conda list

ipykernelをインストール

作成した仮想環境にipykernelをインストールする

conda install -c anaconda ipykernel

jupyter notebookに1で作成した仮想環境を追加

1で作成した仮想環境がアクティベートされている状態で以下のコマンドを実行
*hogehogeの部分は好きな名前に変更してください

ipython kernel install --user --name=hogehoge

jupyter notebookにkernelが追加されたか確認

jupyter kernelspec list

不必要なkernelを削除

以下のコマンドを実行
*hogehogeの部分は削除したいkernelの名前に変更

jupyter kernelspec uninstall hogehoge
0
2
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
0
2