简体   繁体   English

Jupyter:安装新模块

[英]Jupyter: install new modules

I have recently installed Anaconda with Python 3.5 and all the rest. 我最近安装了带有Python 3.5的Anaconda以及其他所有功能。 I come from R where I am used to install packages dynamically. 我来自R,我习惯于动态安装包。 I am trying to install a module called scitools through jupyter notebook. 我试图通过jupyter笔记本安装一个名为scitools的模块。 I would like to recreate this in jupyter. 我想在jupyter中重新创建它。 However, I don't know how to dynamically install packages (if it's possible). 但是,我不知道如何动态安装包(如果可能的话)。 I would greatly appreciate your help. 非常感谢你的帮助。 Thank you! 谢谢!

在此输入图像描述

EDIT: I am trying to use conda as recommended by the community, but it's not working. 编辑:我正在尝试使用社区推荐的conda,但它不起作用。 I am using mac OSX 我正在使用mac OSX

在此输入图像描述

So if you have already done the install with anaconda, you may already have the module installed. 因此,如果您已经使用anaconda完成了安装,则可能已经安装了该模块。 In that case in your jupyter notebook after you have activated your kernel, you just need to make sure you execute the import statement. 在这种情况下,在激活内核后的jupyter笔记本中,您只需要确保执行import语句。

import scitools

If you haven't installed that module yet, you can install it one of two ways. 如果尚未安装该模块,可以使用以下两种方式之一安装。 Both work from your command line or terminal. 两者都可以在命令行或终端上运行。

pip install scitools

or since you have Anaconda 或者因为你有Anaconda

conda install scitools

and that should do it. 那应该这样做。 Your import statement in your notebook when executed should correctly locate and enable the use of that module. 执行时,笔记本中的import语句应正确定位并启用该模块的使用。

Check Jake Vander Plus Blog here to learn how to install a package with pip from Jupyter Notebook. 检查杰克范德加博客在这里学习如何与Jupyter笔记本PIP安装包。

# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install numpy

I had the same issue. 我遇到过同样的问题。 It turns out if you open an anaconda window, which in Windows is accessible under the Anaconda drop down, it points to the correct location to install (or update) using pip. 事实证明,如果你打开一个anaconda窗口,它在Windows中可以通过Anaconda下拉菜单访问,它指向使用pip安装(或更新)的正确位置。

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

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