我将 C:\Octave\Octave-4.0.1\bin 添加到我的 PATH 并且可以成功导入 oct2py,但随后对 oct2py 的调用会使 python 内核崩溃。内核在命令行 python、IPython 和 Spyder 中崩溃。
示例代码:
from oct2py import Oct2Py # works with no errors
oc = Oct2Py(executable="C:/Octave/Octave-4.0.1/bin/octave-cli.exe") # also no errors
oc = Oct2Py() # also returns with no errors.
y = oc.zeros(3,3) # instantly kills the python
我已经尝试过默认的 Oct2Py 工厂并尝试使用可执行文件对其进行初始化,但似乎都不起作用。
内核爆炸的速度感觉像是某种链接错误,但我不确定。
这是我的 Python 和 Octave 版本:
Python 2.7.11 |Anaconda 2.5.0 (64-bit)| (default, Feb 16 2016, 09:58:36) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
GNU Octave, version 4.0.1
Copyright (C) 2016 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.
Octave was configured for "i686-w64-mingw32".
Additional information about Octave is available at http://www.octave.org.
Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html
Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.
octave:1>
更新:
我发现我可以将数据推送到 Octave 中(例如,oc.push('y',5) 创建一个 .mat 临时文件,其中变量 y 分配了 5 的值),但是提取数据(例如,oc.pull('y ')) 杀死蟒蛇。