Python 无法使用 Anaconda 打开 Jupyter 笔记本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41520282/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 01:09:00  来源:igfitidea点击:

Can't open Jupyter notebook with Anaconda

pythonanacondajupyter

提问by Chucky

I just installed Anaconda, in my Surface Pro 3, with Windows 10, using the provided installer for 64-bit. When I try to launch "jupyter notebook" I always get the following message:

我刚刚使用提供的 64 位安装程序在我的 Surface Pro 3 和 Windows 10 中安装了 Anaconda。当我尝试启动“jupyter notebook”时,我总是收到以下消息:

Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\Carlos>jupyter notebook Traceback (most recent call last):

File "C:\Program Files\Anaconda3\Scripts\jupyter-notebook-script.py", line 3, in import notebook.notebookapp

File "C:\Program Files\Anaconda3\lib\site-packages\notebook\notebookapp.py", l ine 32, in from zmq.eventloop import ioloop

File "C:\Program Files\Anaconda3\lib\site-packages\zmq__init__.py", line 34, in from zmq import backend

File "C:\Program Files\Anaconda3\lib\site-packages\zmq\backend__init__.py", l ine 40, in reraise(*exc_info)

File "C:\Program Files\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", lin e 34, in reraise raise value

File "C:\Program Files\Anaconda3\lib\site-packages\zmq\backend__init__.py", l ine 27, in _ns = select_backend(first)

File "C:\Program Files\Anaconda3\lib\site-packages\zmq\backend\select.py", lin e 26, in select_backend mod = import(name, fromlist=public_api)

File "C:\Program Files\Anaconda3\lib\site-packages\zmq\backend\cython__init__ .py", line 6, in from . import (constants, error, message, context,

ImportError: DLL load failed: The specified module could not be found.

Microsoft Windows [版本 10.0.14393] (c) 2016 Microsoft Corporation。版权所有。

C:\Users\Carlos>jupyter notebook Traceback(最近一次调用):

导入 notebook.notebookapp 中的文件“C:\Program Files\Anaconda3\Scripts\jupyter-notebook-script.py”,第 3 行

文件“C:\Program Files\Anaconda3\lib\site-packages\notebook\notebookapp.py”,第32行,in from zmq.eventloop import ioloop

文件“C:\Program Files\Anaconda3\lib\site-packages\zmq__init__.py”,第 34 行,来自 zmq 导入后端

文件“C:\Program Files\Anaconda3\lib\site-packages\zmq\backend__init__.py”,第 40 行,在 reraise(*exc_info)

文件“C:\Program Files\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py”,第 34 行,重新加注值

文件“C:\Program Files\Anaconda3\lib\site-packages\zmq\backend__init__.py”,第27行,在_ns = select_backend(first)

文件“C:\Program Files\Anaconda3\lib\site-packages\zmq\backend\select.py”,第 26 行,在 select_backend mod = import(name, fromlist=public_api)

文件“C:\Program Files\Anaconda3\lib\site-packages\zmq\backend\cython__init__ .py”,第 6 行,来自 . 导入(常量、错误、消息、上下文、

导入错误:DLL 加载失败:找不到指定的模块。

I tried to uninstall/install again several times, I tried to install it just for me or for all the users in the computer, I tried to update anaconda first...with no success. Any clue?

我多次尝试卸载/安装,我尝试只为我或计算机中的所有用户安装它,我尝试先更新 anaconda ......但没有成功。有什么线索吗?

Thanks!

谢谢!

回答by Chucky

It seems to be a problem with the default installation of Anaconda. So, I removed the pyzmqpackage, which seems to be the problematic one.

好像是Anaconda默认安装的问题。所以,我删除了这个pyzmq包,这似乎是有问题的包。

This is what I have done:

这就是我所做的:

  1. conda uninstall pyzmq(This also removes jupyter related packages!)
  2. conda install pyzmq(to reinstall it)
  3. conda install jupyter(to reinstall jupyter related packages)
  1. conda uninstall pyzmq(这也会删除与 jupyter 相关的包!)
  2. conda install pyzmq(重新安装它)
  3. conda install jupyter(重新安装 jupyter 相关的包)

Now I can open Jupyter Notebook!

现在我可以打开 Jupyter Notebook 了!

回答by amandeep1991

I also got somewhat same error today on my system and now it got resolved by following solution.

我今天在我的系统上也遇到了一些相同的错误,现在它通过以下解决方案得到解决。

Please add following in the path variable, it will be resolved thereafter (I just checked):

请在路径变量中添加以下内容,此后将解决(我刚刚检查过):

  • C:\ML\installed_tools\anaconda3 (was already present)
  • C:\ML\installed_tools\anaconda3\Scripts (was already present)
  • C:\ML\installed_tools\anaconda3\Library\bin(added now)
  • C:\ML\installed_tools\anaconda3\Library\mingw-w64\bin(added now)
  • C:\ML\installed_tools\anaconda3(已经存在)
  • C:\ML\installed_tools\anaconda3\Scripts(已经存在)
  • C:\ML\installed_tools\anaconda3\Library\bin现在添加
  • C:\ML\installed_tools\anaconda3\Library\mingw-w64\bin现在添加

Refer this linkfor exact exception which I got (with exact versions of the modules) and resolved thereafter. Above exception might be of older anaconda version but solution should be same.

请参阅此链接以获取我得到的确切异常(具有模块的确切版本)并在此后解决。上述例外可能是较旧的 anaconda 版本,但解决方案应该相同。

回答by Deepak

Here is what worked for me (You have to upgrade pyzmq):

这是对我有用的(您必须升级pyzmq):

python -m pip install --upgrade pip
pip install --upgrade pyzmq

After that it worked fine.

之后它工作得很好。

回答by Srini

There are multiple options to fix this, i am still investigating on the root cause. However, you can try the solution given below..

有多种选择可以解决这个问题,我仍在调查根本原因。但是,您可以尝试下面给出的解决方案。

if the Jupyter notebook version is 5.1.0 & above, you can uninstall using << conda uninstall notebook >> and then install Jupyter notebook from Anaconda Command prompt using << conda install notebook=5.0.0 >> This will help you launch the Anaconda Navigator from base environment itself.

如果 Jupyter notebook 版本是 5.1.0 及以上,您可以使用 << conda uninstall notebook >> 卸载,然后使用 << conda install notebook=5.0.0 >> 从 Anaconda 命令提示符安装 Jupyter notebook 这将帮助您启动来自基础环境本身的 Anaconda Navigator。

Second option.., Create another environment in conda << conda env create -f {name of yml file}.yml >>. After creating, open the Anaconda navigator UI, switch the environment to the newly created environment and launch Jupyter ( this will work even with latest Jupyter notebook version 5.3.7 as well), it will work.

第二个选项..,在 conda << conda env create -f {name of yml file}.yml >> 中创建另一个环境。创建后,打开 Anaconda navigator UI,将环境切换到新创建的环境并启动 Jupyter(即使使用最新的 Jupyter Notebook 5.3.7 版本也可以使用),它会工作。

I am still investigating why the latest version is not opening with the base environment. however, we can use solution 1 or 2 based on your preference.

我仍在调查为什么最新版本没有在基础环境中打开。但是,我们可以根据您的喜好使用解决方案 1 或 2。

回答by Jerusalem Programmer

There may be access privileges issues with installing in the \Program Files folder.

在 \Program Files 文件夹中安装可能存在访问权限问题。

I have Anaconda3 and installed into the root C:\ directory and had no problems with dll file installation like you have.

我有 Anaconda3 并安装到根 C:\ 目录中,并且没有像您一样安装 dll 文件的问题。

Try installing Anaconda3 as Anaconda3 with no spaces directly as its own folder in the C:\ directory.

尝试将 Anaconda3 安装为没有空格的 Anaconda3,直接作为 C:\ 目录中的自己的文件夹。

Once installed, you can use the Anaconda Cheat Sheet to get started quickly to verify that installation works by going into the Anaconda3 folder and (if you are on Windows) SHIFT+RIGHT-CLICK-MOUSE and it will give you menu with open to open Command [Line] Window directly in that directory of Anaconda3. Open the Command Line window and run the commands from the Anaconda Cheat Sheet to quickly get started:

安装后,您可以使用 Anaconda Cheat Sheet 快速开始以通过进入 Anaconda3 文件夹和(如果您使用的是 Windows)SHIFT+RIGHT-CLICK-MOUSE 来验证安装是否有效,它将为您提供打开菜单直接在 Anaconda3 的那个目录下的 Command [Line] Window。打开命令行窗口并运行 Anaconda Cheat Sheet 中的命令以快速入门:

http://conda.pydata.org/docs/_downloads/conda-cheatsheet.pdf

http://conda.pydata.org/docs/_downloads/conda-cheatsheet.pdf

You will need to follow instructions to create virtual Python development environment/folder within the Anaconda3. Then you will need to make sure you install the Jupyter Notebook into that virtual env/folder. Of course you will need to "activate" that virtual env after installing.

您需要按照说明在 Anaconda3 中创建虚拟 Python 开发环境/文件夹。然后,您需要确保将 Jupyter Notebook 安装到该虚拟 env/文件夹中。当然,您需要在安装后“激活”该虚拟环境。

I hope this helps.

我希望这有帮助。