如何从IPython中安装Python包? [英] How to install a Python package from within IPython?

查看:470
本文介绍了如何从IPython中安装Python包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在不离开IPython shell的情况下安装python包。

I wonder if it's possible to install python packages without leaving the IPython shell.

推荐答案

你可以使用这样的前缀:

You can use the ! prefix like this:

!pip install packagename

前缀是%sc 运行shell命令的命令。

The ! prefix is a short-hand for the %sc command to run a shell command.

您还可以使用 !! 前缀是%sx 命令的简写,用于执行shell命令并捕获其输出(保存到 _ 默认情况下的变量。)

You can also use the !! prefix which is a short-hand for the %sx command to execute a shell command and capture its output (saved into the _ variable by default).

这篇关于如何从IPython中安装Python包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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