Jupyter notebook 无法在 conda 环境中加载已安装的包 [英] Jupyter notebook can't load installed package in conda environment

查看:52
本文介绍了Jupyter notebook 无法在 conda 环境中加载已安装的包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个 conda 环境:

$ conda create --name py3 matplotlib scipy astropy photutils

一切都安装正确,包括从

我打开一个使用 Default 内核的新笔记本并尝试加载 photutils

这行不通.

这里发生了什么?我唯一觉得奇怪的是 photutils 包的名称被 Jupyter 显示为 http://ssb.stsci.edu/astroconda::photutils0.4Conda 标签中.这是问题吗?如果是这样,我该如何解决这个问题?

解决方案

default 内核安装在 Jupyter Notebook 的安装环境中.您要么需要 1)在 py3 环境中安装 notebook 包,或者 2)在 py3 环境中安装 ipykernel 环境并从根环境启动 Notebook 服务器,然后使用(现在新添加的)py3 内核启动一个新 Notebook.

I've created a conda environment:

$ conda create --name py3 matplotlib scipy astropy photutils

Everything installed properly, including the photutils package that is installed from the http://ssb.stsci.edu/astroconda channel.

Now I activate the environment and open a Jupyter notebook:

$ source activate py3
(py3) $ jupyter notebook

With py3 as the Default environments, and photutils installed

I open a new notebook that uses the Default kernel and attempt to load photutils

which will not work.

What is going on here? The only thing that I find strange is that the name of the photutils package is shown as http://ssb.stsci.edu/astroconda::photutils0.4 by Jupyter in the Conda tab. Is this the issue? If so, how can I fix this?

解决方案

The default kernel is installed in the environment where the Jupyter Notebook is installed. You either need to either 1) install the notebook pacakge in the py3 environment, or 2) install the ipykernel package in the py3 environment and launch the Notebook server from the root environment, then start a new Notebook with the (now newly added) py3 kernel.

这篇关于Jupyter notebook 无法在 conda 环境中加载已安装的包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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