Python 子流程:";Exec格式错误";在gekko包中
我正在尝试用python 2或3运行gekko。我只是按照一个教程修改了参数,然后使用scipy.integrate来模拟我的MPC。它在我的一台计算机上工作,但在我的NVIDIA Jetson TX2上不工作。并在运行m.solve(disp=False)时得到“Exec format error” 两台计算机都有python2和python3。因为我也在运行ROS,所以我想使用python2来运行脚本。起初,我认为可能是使用python2解释导致了这个问题,所以我编写了另一个脚本,使用subprocess将我的mpc和模拟器解释为python3。然而,这个问题仍然存在。问题似乎在gekko软件包中。我确信这是一个环境错误,因为脚本在我的个人计算机上运行得很好。目前我正在运行Ubuntu 16.04Python 子流程:";Exec格式错误";在gekko包中,python,optimization,gekko,Python,Optimization,Gekko,我正在尝试用python 2或3运行gekko。我只是按照一个教程修改了参数,然后使用scipy.integrate来模拟我的MPC。它在我的一台计算机上工作,但在我的NVIDIA Jetson TX2上不工作。并在运行m.solve(disp=False)时得到“Exec format error” 两台计算机都有python2和python3。因为我也在运行ROS,所以我想使用python2来运行脚本。起初,我认为可能是使用python2解释导致了这个问题,所以我编写了另一个脚本,使用sub
def example_MPC(t_init, x, u_init):
m = GEKKO(remote=False)
dt = 0.5
m.time = np.linspace(t_init,10+t_init,21)
#...
m.solve(disp=False) # <-- The error appears on this line
#...
return p.value[1]
命令告诉我:
-bash: ./apm: cannot execute binary file: Exec format error
我假设这意味着在我的TX2上,apm运行不正常
如果我设置m=GEKKO(remote=True)
,它就会工作。然而,MPC不能实时运行,这对我来说绝对是个问题
我现在尝试在本地桌面上解决这个问题。服务器参数只是本地ip地址吗?我设定:
m = GEKKO(remote=True, server="192.168.1.136")
它返回:
Traceback (most recent call last):
File ".../src/ode_solver.py", line 53, in <module>
simulation()
File ".../src/ode_solver.py", line 34, in simulation
u[i] = example_MPC(t[i-1], v0, u[i-1])
File ".../src/MPC_test.py", line 34, in example_MPC
m.solve(disp=False)
File ".../.local/lib/python2.7/site-packages/gekko/gekko.py", line 1992, in solve
raise ImportError('Results files not found. APM did not find a solution or the server is unreachable.')
ImportError: Results files not found. APM did not find a solution or the server is unreachable.
回溯(最近一次呼叫最后一次):
文件“../src/ode_solver.py”,第53行,在
模拟()
文件“../src/ode_solver.py”,第34行,在模拟中
u[i]=示例_-MPC(t[i-1],v0,u[i-1])
文件“../src/MPC_test.py”,第34行,在示例_MPC中
m、 求解(disp=False)
文件“...local/lib/python2.7/site packages/gekko/gekko.py”,第1992行,在solve中
raise ImportError('未找到结果文件。APM未找到解决方案或无法访问服务器')
ImportError:未找到结果文件。APM未找到解决方案或无法访问服务器。
设置m=GEKKO(远程=True,服务器=http://192.168.1.136“
产生相同的问题。您可以远程解决(需要Internet连接):
m=GEKKO(remote=True)
或者在该服务器(例如IP地址10.0.0.10)上设置或并解决以下问题:
m=GEKKO(remote=True,server=True)http://10.0.0.10')
问题是英伟达JETSON TX2十六进制内核ARMV8 64位CPU没有兼容的可执行文件,否则Python就不会选择正确的可执行文件。您可以通过在Lib/site packages/gekko/bin中查找apm_arm可执行文件或从当前支持的下载来查看它是否将在您的计算机上运行:
- Windows(32或64位):apm.exe
- Linux(64位):apm
- MacOS(64位):apm_mac
- Linux ARM(Raspberry Pi):apm_ARM
remote=True
。我把英伟达JETSON TX2本地可执行文件添加为.< /P> < P>您可以远程解决(需要Internet连接):
m=GEKKO(remote=True)
或者在该服务器(例如IP地址10.0.0.10)上设置或并解决以下问题:
m=GEKKO(remote=True,server=True)http://10.0.0.10')
问题是英伟达JETSON TX2十六进制内核ARMV8 64位CPU没有兼容的可执行文件,否则Python就不会选择正确的可执行文件。您可以通过在Lib/site packages/gekko/bin中查找apm_arm可执行文件或从当前支持的下载来查看它是否将在您的计算机上运行:
- Windows(32或64位):apm.exe
- Linux(64位):apm
- MacOS(64位):apm_mac
- Linux ARM(Raspberry Pi):apm_ARM
如果它没有运行或不在此列表中,我建议对本地服务器或公共可用服务器使用
remote=True
。我把英伟达JexsTx2本地可执行文件添加为.< /p>错误,是因为未能启动一个实用程序,名为m = GEKKO(remote=True, server="192.168.1.136")
Traceback (most recent call last):
File ".../src/ode_solver.py", line 53, in <module>
simulation()
File ".../src/ode_solver.py", line 34, in simulation
u[i] = example_MPC(t[i-1], v0, u[i-1])
File ".../src/MPC_test.py", line 34, in example_MPC
m.solve(disp=False)
File ".../.local/lib/python2.7/site-packages/gekko/gekko.py", line 1992, in solve
raise ImportError('Results files not found. APM did not find a solution or the server is unreachable.')
ImportError: Results files not found. APM did not find a solution or the server is unreachable.