不要输入 import pythonmoduleMATLAB 会自动加载 Python 当输入py.command因为不用输入 import pythonmodule 。MATLAB 中的 import 语句作用与 Python 中不同。Python使用 import 语句加载代码并使之能够访问。MATLAB使用 import 函数是为了不用包名就可以直接使用类或函数。使用 import 缩短类和函数名Python 的 from...import 语句使我们在不使用完全限定名称的情况下引用模块。在 Python 中 import 语句为from x import y在 MATLAB 中则为import x.y其中 y 为类名或函数名。实例Python 中的 textwrap 模块可以格式化文本块S py.textwrap.wrap(This is a string);其中 wrap 并不是 MATLAB 函数就可以使用 import 函数来缩短调用语句。import py.textwrap.wrap S wrap(This is a string);注意不要使用import py.*上式会让 MATLAB 使用所有的 Python函数从而覆盖掉重名的 MATLAB 函数。此命令可以通过下面的命令去除clear import参考资料1.MATLAB 官方文档:https://ww2.mathworks.cn/help/