在jupyter笔记本中的python中,使用"pip3 install wikipedia"进行安装后,无法导入Wikipedia API. [英] In python in jupyter notebooks, unable to import wikipedia API after installing with "pip3 install wikipedia"

查看:299
本文介绍了在jupyter笔记本中的python中,使用"pip3 install wikipedia"进行安装后,无法导入Wikipedia API.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我无法在jupyter笔记本中导入Wikipedia,但在命令提示符下却能够导入Wikipedia.如何成功导入Jupyter?

While I was unable to import Wikipedia in jupyter notebook, in command prompt I am able to import Wikipedia. How to successfully import in Jupyter?

推荐答案

在笔记本中运行以下命令,然后再次尝试导入.

Run the following in your notebook and then try your import again.

%pip install Wikipedia

这是在Jupyter笔记本环境中使用pip的当前最佳方法,请参见

That is the current best way to use pip inside your Jupyter notebook environment, see here. That will help you on a per notebook level.

为了修复它,因此您不需要在笔记本中使用%pip install <package>,您需要弄清Jupyter使用的是哪个python(在正在运行的笔记本中运行!which python会有所帮助),并确保您安装了到该版本或环境的软件包.要进行修复,您可能需要查看已经回答的问题,例如此处此处

For fixing it so you don't need that %pip install <package> in your notebook, you need to sort out which python your Jupyter is using (running !which python in your running notebook would help) and make sure that you install your packages to that version or environment. For fixing that you may want to look around at already answered questions, such as here, here, here, and here. Those examples are just the tip of the iceberg, if you search around.

这篇关于在jupyter笔记本中的python中,使用"pip3 install wikipedia"进行安装后,无法导入Wikipedia API.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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