一段时间以前,我一直在使用ipython和一些jupyter。在将近6个月没有使用它之后,我想再次开始使用它。
我安装了最新版本的jupyter,更新了我的python 2.7安装,得到了pip工作并安装了必要的软件包:
pip install jupyter
pip install notebook
完成后我尝试输入一个旧的笔记本(用2.7编写),但没有与内核的连接。我想,好吧,为什么不更新到最新的python 3版本并试试。这导致了同样的问题。
我继续安装anaconda并创建了两个虚拟环境,一个使用python 2.7,另一个使用python 3.5。两者都安装如下:
conda create --name py27 python=2.7 anaconda
conda create --name py35 python=3.5 anaconda
之后,我确保两个venvs都通过激活它们并尝试安装包装来安装jupyter。 (这是用py27和py35完成的,它们是从上面的命令中看到的venvs的名字)。
activate py27
conda install jupyter
之后我试着跑:
jupyter notebook
我创建了一个新的笔记本文件,看看我是否可以访问内核。但是很明显我没有出现以下错误:
Traceback (most recent call last):
File "E:\Anaconda3\envs\py35\lib\site-packages\notebook\base\handlers.py", line 458, in wrapper
result = yield gen.maybe_future(method(self, *args, **kwargs))
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1014, in run
yielded = self.gen.throw(*exc_info)
File "E:\Anaconda3\envs\py35\lib\site-packages\notebook\services\sessions\handlers.py", line 58, in post
sm.create_session(path=path, kernel_name=kernel_name))
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1014, in run
yielded = self.gen.throw(*exc_info)
File "E:\Anaconda3\envs\py35\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 73, in create_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 282, in wrapper
yielded = next(result)
File "E:\Anaconda3\envs\py35\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 87, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "E:\Anaconda3\envs\py35\lib\site-packages\jupyter_client\multikernelmanager.py", line 109, in start_kernel
km.start_kernel(**kwargs)
File "E:\Anaconda3\envs\py35\lib\site-packages\jupyter_client\manager.py", line 244, in start_kernel**kw)
File "E:\Anaconda3\envs\py35\lib\site-packages\jupyter_client\manager.py", line 190, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "E:\Anaconda3\envs\py35\lib\site-packages\jupyter_client\launcher.py", line 108, in launch_kernel
proc = Popen(cmd, **kwargs)
File "E:\Anaconda3\envs\py35\lib\subprocess.py", line 950, in __init__ restore_signals, start_new_session)
File "E:\Anaconda3\envs\py35\lib\subprocess.py", line 1220, in _execute_child startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
这显然是在我的py35 venv上尝试但是我在py27 venv上得到了同样的错误。我尝试了一些诸如运行kernelspec之类的东西,但没有任何成功。
有人建议可能出现什么问题?
答案 0 :(得分:0)
我遇到了同样的问题。您需要为jupyter笔记本创建kernelspec。请点击此链接解决问题。
How to start an ipython shell(not notebook) within a conda or virtualenv