Setting up Jupyter Notebook for JModelica

妖精的绣舞 提交于 2019-12-05 13:13:59

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

Foad

I addition to what @Jon S mentioned, I want to add that you need to set the environment to 64bit version if you get the error messages like

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-907558296850> in <module>()
----> 1 import pyfmi

C:\JModelica.org-2.10\install\Python\pyfmi\__init__.py in <module>()
     22 
     23 #Import the model class allowing for users to type: from pyfmi import FMUModel
---> 24 from .fmi import FMUModel, load_fmu, FMUModelME1, FMUModelME2
     25 from .fmi import FMUModelCS1, FMUModelCS2
     26 from .fmi_coupled import CoupledFMUModelME2

ImportError: DLL load failed: %1 is not a valid Win32 application.

upon importing any of the JModelica packages. To do so:

  1. open a Windows terminal (cmd, PowerShell, ConEmu...)
  2. navigate to the JModelica installation folder (e.g., cd C:\JModelica.org-2.10 or C:\Users\<user>\AppData\Roaming\JModelica.org-2.10 if you install with Chocolatey)
  3. run setenv.bat 64

Now you should be able to iport all JModelica packages.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!