导入错误:没有名为 IPython 的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45179915/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ImportError: No module named IPython
提问by Jhonatan
When i try to use from IPython.display import clear_output, display_html, then i show the error:
当我尝试使用from IPython.display import clear_output, display_html 时,我显示错误:
(ImportError: No module named IPython)
(导入错误:没有名为 IPython 的模块)
I am using Python 2.7.13, and im trying to make the game of life from John Conway. I am following this link: http://nbviewer.jupyter.org/url/norvig.com/ipython/Life.ipynb
我正在使用 Python 2.7.13,我正在尝试制作 John Conway 的生活游戏。我正在关注此链接:http: //nbviewer.jupyter.org/url/norvig.com/ipython/Life.ipynb
I have read another questions and answers about it, but any answer works for me. First, this error is showed in command line, and when i try to run this code in a file. Second, this error is direct to IPython, not submodule or something similiar.
我已经阅读了关于它的另一个问题和答案,但任何答案都对我有用。首先,此错误显示在命令行中,当我尝试在文件中运行此代码时。其次,这个错误直接针对 IPython,而不是子模块或类似的东西。
采纳答案by Jhonatan
Ok, finally i achieved my goal.
好的,我终于达到了我的目的。
- I wrote ipython --versionbut i found, it was not installed.
- I tried to install it, with pip. I went to C:\Python27\Scripts, here is pip, you can try in this directory, or add to environment variables.
- I tried to install ipython, but i found a error
- 我写了ipython --version但我发现它没有安装。
- 我尝试使用 pip 安装它。我去了C:\Python27\Scripts,这里是pip,你可以在这个目录下试试,或者添加到环境变量中。
- 我尝试安装 ipython,但发现错误
so i installed visual studio c++ 9.0, the version to python 2.7.
所以我安装了visual studio c++ 9.0,python 2.7的版本。
- pip install ipython
- pip 安装 ipython
回答by Shital Shah
For Anaconda try,
对于 Anaconda 尝试,
conda install -c anaconda ipython
回答by Anamitra Musib
Use this code to install the IPython library:
使用此代码安装 IPython 库:
!pip install ipython
import IPython
Well, this works on Google Colab.
嗯,这适用于 Google Colab。
回答by Tessaracter
This is most likely because ipython
is not installed.
这很可能是因为ipython
未安装。
You can install it with pip
.
您可以使用pip
.
pip install ipython
If you are using Anaconda (the full version) ipython
comes preinstalled. If you are using Miniconda or if the ipython is deleted for some reason you can re-install with
如果您使用的ipython
是预装的Anaconda(完整版)。如果您正在使用 Miniconda 或者如果 ipython 由于某种原因被删除,您可以重新安装
conda install -c anaconda ipython
If you are using it with jupyter
. You might want to register the ipython
with a user.
如果您将它与jupyter
. 您可能希望向ipython
用户注册。
python -m ipykernel install [--user] [--name <machine-readable-name>] [--display-name <"User Friendly Name">]
Reference :
参考 :