无法在 Windows 上的新 conda 环境中打开 jupyter notebook

Ray*_*ell 3 python windows anaconda jupyter-notebook

编辑:这似乎是一个 conda-forge 问题。conda install jupyter工作正常。在 GitHub 上打开问题:https : //github.com/conda-forge/jupyter-feedstock/issues/6

长期 python Mac 用户。第一次使用 python windows 用户(windows 7 企业版)。

通过 Anaconda 安装 python ( https://repo.anaconda.com/archive/Anaconda3-5.2.0-Windows-x86_64.exe )

Jupyter Notebook 在基础环境中运行良好。

当我创建一个新环境时,我无法打开 jupyter notebook。

打开 Anaconda 提示:

conda create -n test_env2 python=3.6
conda activate test_env2
conda install -c conda-forge jupyter
jupyter notebook
Run Code Online (Sandbox Code Playgroud)

当我打开 Ipython 笔记本时,它显示“内核错误”: 在此处输入图片说明

明显的错误是:

[E 18:53:32.420 NotebookApp] Failed to run command:
['C:/Users/131416/AppData/Local/Continuum/anaconda3/envs/test_env2/bin/python', '-m', 'ipykernel_launcher', '-f', 'C:\\Users\\131416\\AppData\\Roaming\\jupyter\\runtime\\kernel-99e95812-0a80-4772-94fc-e35563ce58e1.json']

  File "C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\subprocess.py", 
line 997, in _execute_child
   startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

[E 18:53:32.498 NotebookApp] 500 POST /api/sessions (::1) 135.50ms referer=http://localhost:8888/notebooks/Untitled.ipynb?kernel_name=python3
Run Code Online (Sandbox Code Playgroud)

也许它与它jupyter.exe在基础环境和jupyter.exe新环境中的拾取有关: 在此处输入图片说明

https://github.com/jupyter/notebook/issues/2130 中也有一些讨论,但解决方案并不明显。

完整的回溯是(为布局道歉。从cmd复制):

(test_env2) C:\Users\131416>jupyter notebook [I 18:53:24.082 NotebookApp] 从本地目录提供 notebooks:C:\Users\13 1416 [I 18:53:24.084 NotebookApp] Jupyter Notebook 运行于: [I 18:53:24.085 NotebookApp] http://localhost:8888/?token=2ecb94399a83d9dc1f8f11 6e0f28a46e297033c1fd796e23 [I 18:53:24.086] 使用Control-tcw to stop this server 确认关闭 Notebook 的所有内核. [C 18:53:24.089 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
    http://localhost:8888/?token=2ecb94399a83d9dc1f8f116e0f28a46e297033c1fd7
Run Code Online (Sandbox Code Playgroud)

\Users\131416\AppData\Local\Continuu m\anaconda3\envs\test_env2\Library\bin;C:\Users\131416\AppData\Local\C ontinuum\anaconda3\envs\test_env2\Scripts;C:\Users\131416 \AppData\Local\\Continuum\anaconda3\envs\test_env2\bin;C:\Users\131416\AppData\Local\C ontinuum\anaconda3;C:\Users\131416\AppData\Local\Continuum\anaconda3\Lib rary\ mingw-w64\bin;C:\Users\131416\AppData\Local\Continuum\anaconda3\Li brary\usr\bin;C:\Users\131416\AppData\Local\Continuum\anaconda3\Library\bin;C:\ Users\131416\AppData\Local\Continuum\anaconda3\Scripts;C:\Users\131416\AppData\Local\Continuum\anaconda3\bin;c:\Program Files (x86)\ca\\sc\CAWIN\;C: \ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\w indows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1. 0\;C:\Program Files (x86)\Symantec\VIP Access Client\;C:

[E 18:53:32.441 NotebookApp] 未捕获异常 POST /api/sessions (::1) HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/api/sessions ', version='HTTP/1.1', remote_ip='::1') 回溯(最近一次调用最后一次):文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site -packages\tornado\web.py”,第 1592 行,在 _execute result = yield result 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\tornado\gen。 py”,第 1133 行,运行值 = future.result() 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\tornado\gen.py”,行1141,在运行中产生= self.gen。throw(*exc_info) 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\notebook\services\sessions\handlers.py”,第 73 行,post type= mtype)) 文件 "C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\tornado\gen.py",第 1133 行,运行值 = future.result() 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\tornado\gen.py”,第 1141 行,在运行中产生 = self.gen.throw(*exc_info) 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\notebook\services\sessions\sessionmanager.py”,第 79 行,在 create _session kernel_id = yield self.start_kernel_for_session( session_id、路径、名称、类型、kernel_name) 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\tornado\gen.py”,第 1133 行,运行值 = future.result() 文件“ C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\tornado\gen.py”,第 1141 行,运行中产生 = self.gen.throw(*exc_info) 文件“ C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\notebook\services\sessions\sessionmanager.py”,第 92 行,在 start_ kernel_for_session self.kernel_manager.start_kernel(path= kernel_path, kernel_name=kernel_name) 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\tornado\gen.py”,第 1133 行,运行值 = 未来。result() 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\tornado\gen.py”,第 326 行,包装器中产生 = next(result) 文件“ C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\notebook\services\kernels\kernelmanager.py”,第160行,在start_k ernel super(MappingKernelManager, self).start_kernel (**kwargs) 文件 "C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\jupyter_client\multikernelmanager.py",第 110 行,在 start_kernel km.start_kernel(** kwargs) 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\site-packages\jupyter_client\manager.py”,第 259 行,在 start_kernel **kw) 文件“C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib \site-packages\jupyter_client\manager.py”,第 204 行,在 _launch_kernel 中返​​回 launch_kernel(kernel_cmd, **kw) 文件“C:\Users \131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib \site-packages\jupyter_client\launcher.py”,第 128 行,在 launch_kernel proc = Popen(cmd, **kwargs) 文件“C:\Users\ 131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\subprocess.py”,第 709 行,在在launch_kernel proc = Popen(cmd, **kwargs) File "C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\subprocess.py",第709行,在在launch_kernel proc = Popen(cmd, **kwargs) File "C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\subprocess.py",第709行,在init restore_signals, start_new_session) File"C:\Users\131416\AppData\Local\Continuum\anaconda3\envs\test_env2\lib\subprocess.py", line 997, in _execute_child startupinfo) FileNotFoundError: [WinError 2] 系统找不到指定的文件 [W 18:53:32.480 NotebookApp] 未处理的错误 [E 18:53:32.482 NotebookApp] { "Accept": "application/json, text/javascript, / ; q=0.01", "Content-Type": “应用程序/ JSON”, “X-Xsrftoken”: “2 | d69ec7c3 | 9a70043f110f803ee6ab3273dd14309a | 1538153699”, “X-请求-用”: “的XMLHttpRequest”, “Referer的”:“ HTTP://本地主机:8888 /笔记本/无标题.ipynb?kernel_name=python3", "Accept-Language": "en-US", "Accept-Encoding": "gzip, deflate", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv: 11.0) 像 Gecko", "Host": "localhost:8888", "Content-Length": "91", "Connection": "Keep-Alive", "Cache-Control": "no-cache", "饼干 “: ”用户名 - 本地主机-8888 = \“ 2 | 1:0 | 10:1538175204 | 23:用户名 - 本地主机 - 8888 | 44:Y2MwOTgzODhmZDZhNGE4NzhmM2Q2NWJjMDI2MjVjZjc = | a3c49f08f13669a523498b 9125cf42ce7eaab53181c1441544fcf533a94545da \”; _xsrf=2|d69ec7c3|9a70043f110f803ee 6ab3273dd14309a|1538153699;username-localhost-8889=\"2|1:0|10:1538162170|23:use rname-localhost-8889|44:

小智 9

激活环境后,请安装ipykernel

conda install ipykernel
Run Code Online (Sandbox Code Playgroud)

然后运行

jupyter notebook
Run Code Online (Sandbox Code Playgroud)