每次我在Mac OS上运行“ jupyter笔记本”时,为什么总是出现此错误?
情况:
错误:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/notebook/notebookapp.py", line 1697, in start
browser = webbrowser.get(self.browser or None)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 42, in get
register_standard_browsers()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 531, in register_standard_browsers
raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 376, in check_output
**kwargs).stdout
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 453, in run
with Popen(*popenargs, **kwargs) as process:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 756, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1499, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
NotADirectoryError: [Errno 20] Not a directory: 'xdg-settings'
答案 0 :(得分:1)
我有相同的generateMipmap
。对于您而言,它指向的文件是NotADirectoryError: [Errno 20]
。
似乎文件'xdg-settings'
可能是快捷方式,无法找到实际文件。您可以做的只是删除该文件(仅当它是快捷方式时)。然后重新启动jupyter笔记本,它应该可以正常工作。
答案 1 :(得分:1)
对于发现此错误的任何人,这是解决方法(credit to @rrios-eq on Github):
这是
webbrowser.py
中的if / else逻辑错误;一个简单的解决方法是编辑/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py
(或Jupyter指向您的位置),然后寻找 代码中的xdg-settings
。以上几行(在我的情况下为15行),如果将
sys.platform[:3] == "win":
更改为elif sys.platform[:3] == "win":
,则Darwin / Windows / Linux将可以正常工作。我正在从运行python3.7 使用macOS 10.14.2的自制软件。
答案 2 :(得分:1)
来自warp-x:如果您不介意手动打开浏览器,可以在启动笔记本时传递--no-browser
:$ jupyter notebook --no-browser
。
然后,您可以打开浏览器,在浏览器(通常为 localhost:8888
)中手动导航到笔记本并完成您的工作。
答案 3 :(得分:0)
先找到文件page_xml.modify( '
replace value of (//pages/page[@location_type=sql:variable("@type")]/AdditionalInfo/Url/text()[.!=sql:variable("@url")])[1]
with sql:variable("@url")
' );
,然后再找到函数/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py
,然后寻找register_standard_browsers
并用if sys.platform[:3] == "win":
进行更改并保存文件,它应该可以工作。