本文介绍了为JModelica设置Jupyter Notebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Jupyter Notebook编辑JModelica python脚本;但是,安装后,Jupyter笔记本无法找到密钥库,例如pymodelica.

I would like to use Jupyter Notebook for editing JModelica python scripts; however after installing, the Jupyter notebook cannot locate key libraries, such as pymodelica.

以下是我安装用于JModelica 2.1版的Jupyter Notebook的过程:

Here is the process I followed to install Jupyter Notebook for JModelica Version 2.1:

  1. 在IPython终端中:!pip install jupyter

在Windows CMD中,我使用cd C:\JModelica.org-2.1\Python27\Scripts

In windows CMD I navigate using cd C:\JModelica.org-2.1\Python27\Scripts

然后我使用jupyter notebook

在笔记本中,我创建了一个Python 2文件并尝试导入pymodelica库,其后是:

Within the notebook I create a Python 2 file and attempt to import the pymodelica library, which is followed by:

ImportError:没有名为pymodelica的模块

ImportError: No module named pymodelica

大概Jupyter Notebook是从JModelica附带的Python Kernal运行的,在这种情况下,Jupyter Notebook为什么无法找到pymodelica库?为了让Jupyter加载这些库,是否需要更改任何设置?

Presumably the Jupyter Notebook is running from the Python Kernal installed with JModelica, in which case why is Jupyter Notebook unable to locate the pymodelica library? Are there any settings that need to be changed in order for Jupyter to load these libraries?

推荐答案

您需要指示Python在哪里可以找到JModelica.org特定的Python软件包.最简单的方法是在启动jupyter之前运行C:\JModelica.org-2.1\setenv.bat

You need to instruct Python where to find the JModelica.org specific Python packages. The easiest way to do this is to run C:\JModelica.org-2.1\setenv.bat before starting jupyter

这篇关于为JModelica设置Jupyter Notebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 19:23