jupyter shell vs kernel

if the shell (where the notebook is started) is different from the kernel executable, when using

pip install
#or
conda install

it could install to a directory where the python executable in the notebook is not referring to.

the solution is

# check the python shell
!type python


# check the executable path
sys.executable

when install, make sure it align, or using the command

!conda install --yes --prefix {sys.prefix} numpy
#or

!{sys.executable} -m pip install numpy

https://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s