我目前已安装Python 3,并希望在Jupyter Notebook中将Python 2.7作为第二个内核安装。我能够安装Python 2.7,但是,当我在Jupyter笔记本中更改内核时,在Anaconda命令提示符下收到以下错误:
[I 17:49:16.185 NotebookApp] Starting buffering for 069e4484-8d64-46e2-b62a-3588e46b4686:2857761af92f4e9387378c8162efbf40
[I 17:49:16.406 NotebookApp] Kernel shutdown: 069e4484-8d64-46e2-b62a-3588e46b4686
[I 17:49:16.453 NotebookApp] Kernel started: a9d7404d-02f1-4295-854d-0b11120cd3d2
Traceback (most recent call last):
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\connect.py", line 18, in <module>
import jupyter_client
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\connect.py", line 24, in <module>
import zmq
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
[I 17:49:19.462 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\connect.py", line 18, in <module>
import jupyter_client
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\connect.py", line 24, in <module>
import zmq
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
[I 17:49:22.484 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
Traceback (most recent call last):
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\connect.py", line 18, in <module>
import jupyter_client
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\connect.py", line 24, in <module>
import zmq
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
[I 17:49:25.514 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports
Traceback (most recent call last):
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\connect.py", line 18, in <module>
import jupyter_client
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\connect.py", line 24, in <module>
import zmq
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
[I 17:49:28.529 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\ipykernel\connect.py", line 18, in <module>
import jupyter_client
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\jupyter_client\connect.py", line 24, in <module>
import zmq
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Nick Alexander\Anaconda3\envs\py27\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
[W 17:49:31.528 NotebookApp] KernelRestarter: restart failed
[W 17:49:31.528 NotebookApp] Kernel a9d7404d-02f1-4295-854d-0b11120cd3d2 died, removing from map.
所有python 2.7安装文件似乎都在错误消息指定的路径中。谢谢!
答案 0 :(得分:0)
我不确定这是否可以解决您的问题,但请尝试运行
\path\to\your\install\of\python\python2.7 -m jupyter notebook
这将有望在python2.7中打开jupyter
答案 1 :(得分:0)
您安装了Anaconda吗?
使用Anaconda,您可以轻松创建具有所需python版本的新虚拟环境:
conda create --name py27 python=2.7
将使用Python 2.7版创建一个新环境。
conda create --name py37 python=3.7
将使用Python 3.7版创建一个新环境。
这是在同一台计算机上使用多个Python版本的最佳方法-我认为-此外,您不需要在计算机上安装任何版本的Python,Anaconda会为您做到这一点。