Python 在 Miniconda 上安装 Jupyter Notebook
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49141525/
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
Install Jupyter Notebook on Miniconda
提问by Emilio
I installed Minicondaand I'm trying to use Jupyter Notebookwith it but haven't been able to do so. After installing miniconda I ran the jupyter notebook
command on my terminal and jupyter wasn't installed.
我安装了Miniconda并且我正在尝试将Jupyter Notebook与它一起使用,但一直无法这样做。安装 miniconda 后,我在jupyter notebook
终端上运行了命令,但未安装 jupyter。
I went ahead and installed it with the conda install jupyter
. However, I once again ran jupyter notebook
on my terminal and got the following console error:
我继续安装它conda install jupyter
。但是,我再次jupyter notebook
在终端上运行并收到以下控制台错误:
Emilios-MacBook-Pro:documents emilioramirezeguia$ jupyter notebook Traceback (most recent call last): File "/Users/emilioramirezeguia/miniconda2/bin/jupyter-notebook", line 7, in from notebook.notebookapp import main File "/Users/emilioramirezeguia/miniconda2/lib/python2.7/site-packages/notebook/notebookapp.py", line 45, in ioloop.install() File "/Users/emilioramirezeguia/miniconda2/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 210, in install assert (not ioloop.IOLoop.initialized()) or \ AttributeError: type object 'IOLoop' has no attribute 'initialized'
Emilios-MacBook-Pro:documents emilioramirezeguia$ jupyter notebook 回溯(最近一次调用最后一次):文件“/Users/emilioramirezeguia/miniconda2/bin/jupyter-notebook”,第 7 行,从 notebook.notebookapp 导入主文件“/Users/ emilioramirezeguia/miniconda2/lib/python2.7/site-packages/notebook/notebookapp.py”,第 45 行,在 ioloop.install() 文件“/Users/emilioramirezeguia/miniconda2/lib/python2.7/site-packages/zmq /eventloop/ioloop.py", line 210, in install assert (not ioloop.IOLoop.initialized()) 或 \ AttributeError: type object 'IOLoop' has no attribute 'initialized'
Any idea how to fix this?
知道如何解决这个问题吗?
Thank you
谢谢
回答by nitred
This problem has just happened to me as well. My older anaconda environments seem to be working fine but the environments I have created today seem to have this exact issue which throws AttributeError: type object 'IOLoop' has no attribute 'initialized'
.
这个问题也刚刚发生在我身上。我较旧的 anaconda 环境似乎工作正常,但我今天创建的环境似乎有这个确切的问题,它会引发AttributeError: type object 'IOLoop' has no attribute 'initialized'
.
It seems to be because of the latest release of tornado==5.0
which released either today or yesterday. I reverted back to the last stable version i.e. tornado==4.5.3
and it worked.
似乎是因为tornado==5.0
今天或昨天发布的最新版本。我恢复到最后一个稳定版本,即tornado==4.5.3
它起作用了。
Here's the solution
这是解决方案
pip uninstall tornado
pip install tornado==4.5.3
回答by Steve
Miniconda is OK but Anaconda is recommend.
Miniconda 还可以,但建议使用 Anaconda。
I have the same issue and thanks Nitred give the right solution.
我有同样的问题,感谢 Nitred 提供正确的解决方案。
It seems that jupyter notebook does not support the tornado 5.0. So downgrade as the following:
jupyter notebook 好像不支持 tornado 5.0。所以降级如下:
pip uninstall tornado
pip install tornado==4.5.3
回答by Geoffrey Anderson
I needed matplotlib in python, and need jupyter working. The package will try to uninstall matplotlib if you uninstall tornado, unless you do a force. But I still need matplotlib, I need that. So I still need to force matplotlib to use the old version of tornado. Turns out I had two tornado versions, one installed by pip, other installed by conda.
我需要 python 中的 matplotlib,并且需要 jupyter 工作。如果您卸载 Tornado,该软件包将尝试卸载 matplotlib,除非您强制执行。但我仍然需要 matplotlib,我需要那个。所以还是需要强制matplotlib使用旧版本的tornado。原来我有两个 Tornado 版本,一个由 pip 安装,另一个由 conda 安装。
Ultimately running these commands got jupyter and matplotlib working again: (Ran it in the conda environment that was broken.)
最终运行这些命令让 jupyter 和 matplotlib 再次工作:(在损坏的 conda 环境中运行它。)
conda remove tornado --force # keeps matplotlib
pip uninstall tornado
conda install tornado=4.5.3
I earlier had used pip to install tensorflow library, which I also need, and maybe it brought along the junky tornado v5, not sure.
我之前使用 pip 安装了我也需要的 tensorflow 库,也许它带来了垃圾龙卷风 v5,不确定。