如何在 Jupyter 笔记本上为新笔记本切换环境?

How to switch environment on Jupyter notebook for new notebook?(如何在 Jupyter 笔记本上为新笔记本切换环境?)
本文介绍了如何在 Jupyter 笔记本上为新笔记本切换环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我有一个具有各种环境的实例,并且一些笔记本与不同的环境兼容,例如notebook1 用于 MXNet,notebook2 用于 TensorFlow.

I have an instance with various environment and some notebooks are compatible with different environment for e.g. notebook1 is for MXNet and notebook2 is for Tensorflow.

当我从 notebook1 移动到 notebook2 时,如何跳转到新环境?我试过这样做,但这不适用于 Jupyter 笔记本?有什么建议吗?

How do I jump to new environment when I move from notebook1 to notebook2? I tried doing that but this doesn't quite work with Jupyter notebook? Any suggestion?

所以我需要从 conda 环境中执行此操作,但看起来 jupyter notebook UI 不尊重(调用正确的激活函数)来设置路径.

So I need to do it from conda environment but looks like jupyter notebook UI doesn't respect (calls right activation function) to set the path.

推荐答案

你可以使用 nb_conda_kernels 包,它为每个 conda 环境提供了一个单独的 jupyter 内核,以及处理它们的设置的适当代码.这使得切换 conda 环境就像切换 jupyter 内核(例如从内核菜单)一样简单,我觉得这非常方便.您可以从 conda-forge 频道获取它,使用

You could use the nb_conda_kernels package, which provides a separate jupyter kernel for each conda environment, along with the appropriate code to handle their setup. This makes switching conda environment as simple as switching jupyter kernel (e.g. from the kernel menu), which I find very convenient. You can get it from the conda-forge channel, using

conda install -c conda-forge nb_conda_kernels

这篇关于如何在 Jupyter 笔记本上为新笔记本切换环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

python arbitrarily incrementing an iterator inside a loop(python在循环内任意递增迭代器)
Joining a set of ordered-integer yielding Python iterators(加入一组产生 Python 迭代器的有序整数)
Iterating over dictionary items(), values(), keys() in Python 3(在 Python 3 中迭代字典 items()、values()、keys())
What is the Perl version of a Python iterator?(Python 迭代器的 Perl 版本是什么?)
How to create a generator/iterator with the Python C API?(如何使用 Python C API 创建生成器/迭代器?)
Python generator behaviour(Python 生成器行为)