简体   繁体   English

Jupiter notebook 找不到虚拟环境中的库

[英]Jupiter notebook doesn't find libraries from the virtual env

I created a Pyenv virtual env.我创建了一个 Pyenv 虚拟环境。 After activating the env, I download libraries like pandas into it.激活环境后,我将pandas等库下载到其中。 However, when I open a jupyter notebook from the same environment's terminal, pandas is not found there.但是,当我从同一环境的终端打开 jupyter 笔记本时,在那里找不到 pandas。 It gives a module not found.它给出了一个未找到的模块。 I believe it's because the Jupiter notebook is using python from somewhere else while my other terminal was using python from somewhere else:我相信这是因为 Jupiter 笔记本正在从其他地方使用 python 而我的另一个终端正在从其他地方使用 python:

From my terminal, when I check which python , I get this:从我的终端,当我检查which python时,我得到这个:

/Users/username/.pyenv/shims/python

How can I ensure that my jupypter notebook is using the same env?如何确保我的 jupypter notebook 使用相同的环境?

PS I know I can separately install libraries again in the Jupiter notebook but that's not my qs PS 我知道我可以在 Jupiter 笔记本中再次单独安装库,但这不是我的 qs

I would suggest to click on "Kernel" in the jupyter notebook bar (in the top).我建议在 jupyter 笔记本栏(顶部)中单击“内核”。 Next go to "Change Kernel" then select the venv you created接下来 go 到“更改内核”然后 select 你创建的 venv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM