gpt4 book ai didi

python - 从 Python 虚拟环境调用 matlab

转载 作者:行者123 更新时间:2023-11-28 19:17:38 24 4
gpt4 key购买 nike

我可以从我的系统 python 调用 MATLAB:

>>> import matlab.engine
>>>

但是当我加载虚拟环境时,我现在遇到段错误:

>>> import matlab.engine
Segmentation fault: 11

我已经运行了 setup.py install instructions对于系统 python 和我的虚拟环境。

我期待问题 like this one ,我必须在其中显式设置 DYLD_LIBRARY_PATH 才能解决问题,但是当我运行系统 python 时,我没有设置该环境变量。

导致此段错误的两个 python 实现之间可能有什么不同?

编辑:我在 2013 年末的 13"Macbook Pro 上使用 OS X Yosemite。我在新安装的虚拟环境(不是虚拟机)中使用 Python 2.7。

最佳答案

我这样做了:

cd "matlabroot\extern\engines\python"
python setup.py install --prefix="installdir"

installdir 是我的 virtualenv,matlabroot 是 MatLab 安装目录。

到目前为止,似乎可以与我的 Windows 服务器一起使用,非常好。

此处引用:

https://www.mathworks.com/help/matlab/matlab_external/install-matlab-engine-api-for-python-in-nondefault-locations.html

关于python - 从 Python 虚拟环境调用 matlab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31550622/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com