我是否需要在每个虚拟环境中安装 Jupyter notebook?

use*_*350 9 virtual-environment jupyter-notebook pipenv

我使用pipenv. 但是,运行 Jupyter Notebok 不会访问本地环境,而是使用默认的 IPyKernel。我已经看到您可以从环境中注册虚拟环境,但这需要安装ipykernel本身需要 Jupyter的包!

有没有办法避免这种情况,只为所有虚拟环境使用一个 Jupyter 安装?

小智 2

通常,您只需安装一次 jupyter,然后在虚拟环境中执行以下操作:

pip install ipykernel  
python -m ipykernel install --user
Run Code Online (Sandbox Code Playgroud)

当您运行多个 Python 版本时,这还不够。
这里有一个指南试图解决这个问题:
https://medium.com/@henriquebastos/the-definitive-guide-to-setup-my-python-workspace-628d68552e14

它不是 100% 故障安全,但它可以帮助您避免一直重新安装 jupyter 笔记本。

  • ipykernel 依赖于 jupyter-core,所以这个有效只是再次安装 Jupyter。 (2认同)