简体   繁体   English

来自 Git Bash 的 Jupyter 笔记本在这里

[英]Jupyter Notebook from Git Bash Here

I have Git for Windows and want to be able to start Jupyter Notebook in a directory of choosing using File Explorer.我有 Git 为 Windows,并希望能够在使用文件资源管理器选择的目录中启动 Jupyter Notebook。 If I right click in a directory and select "Git Bash Here," a Bash shell opens.如果我右键单击目录和 select “Git Bash Here”,则会打开 Bash shell。 I already added my Anaconda directory (where my Python 3.7 is located) into the user path, and I can verify that Bash sees that in the path by "env|grep PATH".我已经将我的 Anaconda 目录(我的 Python 3.7 所在的位置)添加到用户路径中,我可以通过“env|grep PATH”验证 Bash 在路径中看到它。 However, when I type "jupyter notebook" from the Bash prompt, it finds the script and it starts to run, but reports an "ImportError: DLL load failed: The specified module could not be found."但是,当我在 Bash 提示符下键入“jupyter notebook”时,它会找到脚本并开始运行,但会报告“ImportError:DLL 加载失败:找不到指定的模块。”

How do I set the Bash environment to start a Jupyter Notebook from the current directory where I have a Bash prompt?如何设置 Bash 环境以从出现 Bash 提示的当前目录启动 Jupyter Notebook?

When you install Jupyter via anaconda it isn't added to the system's enviornment variables.当您通过 anaconda 安装 Jupyter 时,它不会添加到系统的环境变量中。 Your system doesn't know about Jupyter.您的系统不知道 Jupyter。 Only anaconda does because it is managing your packages and your versions for each project you create.只有 anaconda 会这样做,因为它为您创建的每个项目管理您的包和版本。

If you're using bash for windows I would think you'd have to install Jupyter notebooks to windows and add it to your environment variables to be able to see it in any directory.如果您在 Windows 上使用 bash,我认为您必须将 Jupyter 笔记本安装到 Windows 并将其添加到您的环境变量中,以便能够在任何目录中看到它。

Edit: Here's a picture of me running Jupyter from my windows command line and from the Anaconda prompt.编辑:这是我从 Windows 命令行和 Anaconda 提示符运行 Jupyter 的图片。

在此处输入图片说明

我用以下命令解决了这个问题:

source "C:\Users\...\Anaconda3\Scripts\activate"

In your GitBash prompt type the following command在 GitBash 提示符下键入以下命令

. Anaconda3/Scripts/activate

assuming you are in your home directory.假设你在你的主目录中。 This will allow you to run jupyter from GitBash and also use UNIX commands from jupyter.这将允许您从 GitBash 运行 jupyter 并从 jupyter 使用 UNIX 命令。

在我的系统中遇到同样的问题是通过使用以下命令解决的:

source "C:\Users\...\Anaconda3\Scripts\activate"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM