我在python和matlab中自学了一些编程。我需要运行一些我用pylab在python中编写的函数。
我已经按照pymatlab和python(x,y)的基本安装说明进行操作。当我尝试使用以下代码创建MATLAB会话时:
import pymatlab
session = pymatlab.session_factory()
我收到以下错误:
Exception AttributeError: "'MatlabSession' object has no attribute 'engine'" in <bound method MatlabSession.__del__ of <pymatlab.matlab.MatlabSession object at 0x03654AF0>> ignored
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
session = pymatlab.session_factory()
File "C:\Python27\lib\site-packages\pymatlab\sessionfactory.py", line 51, in session_factory
session = MatlabSession(path=basedir,bufsize=output_buffer_size)
TypeError: __init__() got an unexpected keyword argument 'path'
请帮忙!
答案 0 :(得分:2)
这是Windows平台中修复的bug。你可以打开文件“C:\ Python27 \ lib \ site-packages \ pymatlab \ sessionfactory.py”并找到第51行,删除参数前缀“path =”
MatlabSession(path=basedir,bufsize=output_buffer_size)
转入
MatlabSession(basedir,bufsize=output_buffer_size)
然后你可以享受你的pymatlab。