使用 pyfmi 库在 python 中加载 fmu 时出错
Error while loading a fmu in python with pyfmi library
我已经安装了 PyFMI 库,并试图在 python 中加载由 GT-Suite 创建的 fmu。
我正在学习 jmodelica 教程:
https://jmodelica.org/pyfmi/tutorial.html
# Import the load function (load_fmu)
from pyfmi import load_fmu
本集给出警告
Could not find cannot import name 'radau5' from 'assimulo.lib' (C:\Users\chinn\Anaconda3\lib\site-packages\assimulo\lib\__init__.py)
Could not find cannot import name 'dopri5' from 'assimulo.lib' (C:\Users\chinn\Anaconda3\lib\site-packages\assimulo\lib\__init__.py)
Could not find cannot import name 'rodas' from 'assimulo.lib' (C:\Users\chinn\Anaconda3\lib\site-packages\assimulo\lib\__init__.py)
Could not find cannot import name 'odassl' from 'assimulo.lib' (C:\Users\chinn\Anaconda3\lib\site-packages\assimulo\lib\__init__.py)
Could not find ODEPACK functions.
Could not find RADAR5
Could not find GLIMDA.
当我尝试加载 fmu 模型时
#Load the FMU
model = load_fmu('AHUdirectRPm.fmu')
我收到一个错误
Traceback (most recent call last):
File "<ipython-input-2-77df09904b1e>", line 1, in <module>
model = load_fmu('AHUdirectRPm.fmu')
File "src\pyfmi\fmi.pyx", line 7899, in pyfmi.fmi.load_fmu
File "src\pyfmi\fmi.pyx", line 2558, in pyfmi.fmi.FMUModelCS1.__init__
File "src\pyfmi\fmi.pyx", line 1167, in pyfmi.fmi.FMUModelBase.__init__
File "src\pyfmi\fmi.pyx", line 45, in pyfmi.fmi.encode
TypeError: latin_1_encode() argument 1 must be str, not bytes
有人可以帮我解决这个问题吗?怎么办?
'pyfmi.check_packages()'
的输出
Performing pyfmi package check
==============================
PyFMI version ................ 2.5
Platform ..................... win32
Python version ............... 3.7.3
Dependencies:
Package Version
------- -------
assimulo...................... 3.0
Cython........................ 0.29.6
lxml.......................... 4.3.2
matplotlib.................... 3.0.3
numpy......................... 1.16.2
scipy......................... 1.2.1
wxPython...................... -- Package missing - Warning issued, see details below
pyreadline.................... 2.1
setuptools.................... 40.8.0
Warnings
--------
-- The package wxPython could not be found. This package is needed to be able to use the plot-GUI.
使用 pip 安装 pyfmi 包是 error.All 必须正确下载依赖项。通过 conda 安装不需要所有这些。
通过 conda 安装
conda install -c conda-forge pyfmi
这对我来说效果很好
错误:
Traceback (most recent call last):
File "<ipython-input-2-77df09904b1e>", line 1, in <module>
model = load_fmu('AHUdirectRPm.fmu')
File "src\pyfmi\fmi.pyx", line 7899, in pyfmi.fmi.load_fmu
File "src\pyfmi\fmi.pyx", line 2558, in pyfmi.fmi.FMUModelCS1.__init__
File "src\pyfmi\fmi.pyx", line 1167, in pyfmi.fmi.FMUModelBase.__init__
File "src\pyfmi\fmi.pyx", line 45, in pyfmi.fmi.encode
TypeError: latin_1_encode() argument 1 must be str, not bytes
是由于 PyFMI 的内部编码问题,将在更高版本的 PyFMI (>2.5) 中修复。
我已经安装了 PyFMI 库,并试图在 python 中加载由 GT-Suite 创建的 fmu。
我正在学习 jmodelica 教程:
https://jmodelica.org/pyfmi/tutorial.html
# Import the load function (load_fmu)
from pyfmi import load_fmu
本集给出警告
Could not find cannot import name 'radau5' from 'assimulo.lib' (C:\Users\chinn\Anaconda3\lib\site-packages\assimulo\lib\__init__.py)
Could not find cannot import name 'dopri5' from 'assimulo.lib' (C:\Users\chinn\Anaconda3\lib\site-packages\assimulo\lib\__init__.py)
Could not find cannot import name 'rodas' from 'assimulo.lib' (C:\Users\chinn\Anaconda3\lib\site-packages\assimulo\lib\__init__.py)
Could not find cannot import name 'odassl' from 'assimulo.lib' (C:\Users\chinn\Anaconda3\lib\site-packages\assimulo\lib\__init__.py)
Could not find ODEPACK functions.
Could not find RADAR5
Could not find GLIMDA.
当我尝试加载 fmu 模型时
#Load the FMU
model = load_fmu('AHUdirectRPm.fmu')
我收到一个错误
Traceback (most recent call last):
File "<ipython-input-2-77df09904b1e>", line 1, in <module>
model = load_fmu('AHUdirectRPm.fmu')
File "src\pyfmi\fmi.pyx", line 7899, in pyfmi.fmi.load_fmu
File "src\pyfmi\fmi.pyx", line 2558, in pyfmi.fmi.FMUModelCS1.__init__
File "src\pyfmi\fmi.pyx", line 1167, in pyfmi.fmi.FMUModelBase.__init__
File "src\pyfmi\fmi.pyx", line 45, in pyfmi.fmi.encode
TypeError: latin_1_encode() argument 1 must be str, not bytes
有人可以帮我解决这个问题吗?怎么办?
'pyfmi.check_packages()'
的输出
Performing pyfmi package check
==============================
PyFMI version ................ 2.5
Platform ..................... win32
Python version ............... 3.7.3
Dependencies:
Package Version
------- -------
assimulo...................... 3.0
Cython........................ 0.29.6
lxml.......................... 4.3.2
matplotlib.................... 3.0.3
numpy......................... 1.16.2
scipy......................... 1.2.1
wxPython...................... -- Package missing - Warning issued, see details below
pyreadline.................... 2.1
setuptools.................... 40.8.0
Warnings
--------
-- The package wxPython could not be found. This package is needed to be able to use the plot-GUI.
使用 pip 安装 pyfmi 包是 error.All 必须正确下载依赖项。通过 conda 安装不需要所有这些。
通过 conda 安装conda install -c conda-forge pyfmi
这对我来说效果很好
错误:
Traceback (most recent call last):
File "<ipython-input-2-77df09904b1e>", line 1, in <module>
model = load_fmu('AHUdirectRPm.fmu')
File "src\pyfmi\fmi.pyx", line 7899, in pyfmi.fmi.load_fmu
File "src\pyfmi\fmi.pyx", line 2558, in pyfmi.fmi.FMUModelCS1.__init__
File "src\pyfmi\fmi.pyx", line 1167, in pyfmi.fmi.FMUModelBase.__init__
File "src\pyfmi\fmi.pyx", line 45, in pyfmi.fmi.encode
TypeError: latin_1_encode() argument 1 must be str, not bytes
是由于 PyFMI 的内部编码问题,将在更高版本的 PyFMI (>2.5) 中修复。