Overview
Isn't it sometimes?
In this situation
bash
$ pyenv versions
system
3.6.12
* 3.8.6 (set by /Users/kuryu/.pyenv/version)
Start jupyter with 3.8.6
and aim to run the kernel with 3.6.12
.
bash
$ python -V
Python 3.8.6
$ pip install jupyter
bash
$ pyenv global 3.6.12
$ python -V
Python 3.6.12
It is possible to build it as it is in the pyenv environment, but this time we will create venv.
bash
$ python -m venv .venv
$ . .venv/bin/activate
(.venv) $ python -V
Python 3.6.12
(.venv) $ pip list
Package Version
---------- -------
pip 18.1
setuptools 40.6.2
You are using pip version 18.1, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
bash
(.venv) $ pip install ipykernel
(.venv) $ ipython kernel install --user --name=hoge
bash
(.venv) $ deactivate
bash
$ pyenv global 3.8.6
$ python -V
Python 3.8.6
bash
$ jupyter notebook
I was able to boot the 3.6.12 kernel in jupyter that booted in 3.8.6.
By the way, I forgot to take a screenshot,
jupyter
sys.executable
If you do something like that, the python path of the venv environment will be displayed properly.
bash
$ jupyter kernelspec uninstall hoge
It's a story, but be careful not to get confused because it's confusing.
cf.
https://qiita.com/Gattaca/items/80a5d36673ba2b6ef7f0
Recommended Posts