首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将Jupyter Notebook (Windows) shell更改为bash

问如何将Jupyter Notebook (Windows) shell更改为bash
EN

Stack Overflow用户
提问于 2018-09-14 18:52:59
回答 2查看 4.1K关注 0票数 7

我目前在使用Python 3.6.4的Conda环境中运行Jupyter Notebook (Windows7),我当前的Jupyter Notebook版本是5.6.0。我读到了下面这篇文章:Using Git Bash in Jupyter Notebook on Windows ,它解释了如何通过更改配置"C.NotebookApp.terminado_settings = {' shell _command':'C:\Program Files\Git\bin\bash.exe'}将Jupyter Notebook中的默认shell更改为bash。

​

Python和Jupyter版本:

​

Jupyter Notebook:未更改,仍使用Powershell

我已经阅读了Jupyter Notebook: Read the Docs ,并对C:\Users\UserName.jupyter目录下的jupyter_notebook_config.py进行了更改,但没有成功。

​

​

EN

回答 2

Stack Overflow用户

发布于 2019-03-23 14:30:25

您的问题的另一个解决方案是使用Windows Subsystem for Linux (WSL)。我使用的是Windows 10、conda 4.5.11和Jupyter lab 0.35.3。我还激活了Linux的Windows子系统(WSL)。使用!wsl,您可以调用WSL,或者使用%%bash实现细胞魔术。在Jupyter Lab中,我有:

​

%%bash单元是指WSL吗?根据我的测试,是的,我可以访问相同的程序,当我从Conda提示符运行bash.exe时,我被带到WSL。将PowerShell提示符集成到WSL (https://docs.microsoft.com/en-us/windows/wsl/interop)。这似乎也适用于conda提示符。

票数 4
EN

Stack Overflow用户

发布于 2020-03-24 22:46:45

这里有三个选项:

  1. 如果通过GitBash使用jupyter notebook打开Jupyter notebook,那么如果希望始终能够在通过Anaconda Prompt打开的Jupyter Notebook中运行bash (类似于使用jupyter notebook):

),那么%%bash magics应该可以运行

代码语言:javascript
复制
- Edit the Jupyter Notebook config file:
代码语言:javascript
复制
    - Location can be found via Anaconda Prompt with `jupyter --config-dir`
    - Open the jupyter\_notebook\_config.py file in this directory using notepad or an IDE
    - Modify and save with the line of code: `c.NotebookApp.terminado_settings = {}` pointed instead to your bash executible (e.g.): `c.NotebookApp.terminado_settings = { 'shell_command': ['C:\Program Files\Git\bin\bash.exe'] }`

​

代码语言:javascript
复制
- Edit your system environment variables:
代码语言:javascript
复制
    - Windows Search (with admin rights) > "Edit the System Environment Variables" > Environment Variables > Highlight "path" > Edit > Add a new line with C:\Program Files\Git\bin > OK out of all windows

​

​

  1. Set an environment variable in Jupyter Notebook
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52330492

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档