如何为Anaconda / Jupyter设置默认环境? [英] How to set a default environment for Anaconda / Jupyter?

查看:649
本文介绍了如何为Anaconda / Jupyter设置默认环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的机器学习课程安装了Anaconda。我正在使用它作为IPython(Jupyter)笔记本,我们在其中上课。操作系统是Ubuntu 14.04 LTS。基本上,我总是从终端运行它:

I have installed Anaconda for my Machine Learning course. I'm using it as IPython (Jupyter) notebook, in which we have lessons. OS is Ubuntu 14.04 LTS. Basically, I always run it from Terminal with:

jupyter notebook

我从 root 创建了名为 su_env 的新环境添加了一个包的环境(精确副本)。现在,我想知道:如何将环境 su_env 设置为默认值?我有十几个笔记本,所以每次为每个笔记本设置环境,在J​​upyter的webGUI中设置都很烦人。

I have created new environment called su_env from root environment (exact copy) with one package added. Now, I'm wondering: how can I set environment su_env as default one? I have dozen of notebooks so it's annoying to set up each time for every notebook the environment, in "web" GUI of Jupyter.

编辑:我对在运行笔记本之前无需设置环境的解决方案感兴趣。我的逻辑是,不知何故,自动化,jupyter在启动时自行设置 root 环境。因此,我想知道是否可以设置一些配置文件或其他东西,以便jupyter设置 su_env 而不是 root 。另外,如果你知道那是不可能的(以及为什么),我想知道。

I'm interested in a solution where you don't have to set environment before running notebook. My logic is that, somehow, automagically, jupyter sets root environment on its own while starting up. Because of that, I'm wondering is it possible to set some config file or something so jupyter sets su_env instead of root. Also, if you know that's not possible (and why), I would like to know that.

推荐答案

首先激活conda环境从命令行,然后启动笔记本服务器。

First activate the conda environment from the command line, then launch the notebook server.

例如:

$ source activate env_name
$ jupyter notebook

注意:这可能仅适用于在Jupyter Notebook中创建的环境,而不适用于使用<$创建的环境在命令行上c $ c> conda create 。

Note: This might only work with environments that were created from within Jupyter Notebook, not environments that were created using conda create on the command line.

这篇关于如何为Anaconda / Jupyter设置默认环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆