首页 > 解决方案 > 在 Matlab 中使用 Python 和 NumPy

问题描述

我目前尝试在 Matlab 中调用 Python 函数。一切正常,直到我尝试在我的 Python 函数中使用任何标准库。在我的情况下,它的 NumPy 应该被使用。而不是输出,Matlab 给了我错误:

使用 _distributor_init> 时出错(第 34 行) Python 错误:ImportError:DLL 加载失败:找不到模块。

_distributor_init.py 是 NumPy 的一部分,第 33/34 行是:

with RTLD_for_MKL():
    from . import _mklinit

有谁知道如何将 Python 与 NumPy 连接到 Matlab?

标签: pythonmatlabnumpy

解决方案


运行pyversion并确保它指向适当的 anaconda 环境 bin。显然,numpy 安装在那个 python 环境中。


推荐阅读