“未定义的变量" py"或“类别"尝试从MATLAB R2014b加载Python时? [英] "Undefined variable "py" or class" when trying to load Python from MATLAB R2014b?

查看:587
本文介绍了“未定义的变量" py"或“类别"尝试从MATLAB R2014b加载Python时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

def c1(a1,b1):
    a1=2
    b1=3
    cc=a1+b1
    return cc

我已将此功能保存在test.py中.当我在MATLAB中使用此函数时,遇到了此问题:

I have saved this function in test.py. When I use this function in MATLAB I encountered this problem:

import py.test.* c1(2,3)
Undefined function 'c1' for input arguments
of type 'double'.
  py.test.c1(2,3)
Undefined variable "py" or class
"py.test.c1".

如何在MATLAB R2014b中使用.py函数?

How can I use .py function in MATLAB R2014b?

推荐答案

如果收到以下错误消息,则表明发生了故障.

If you get the error message below, a failure has occurred.

未定义的变量"py"或类

Undefined variable "py" or class

这里可能有很多错误,Mathworks实际上已经设置了,因此它应包含您所需要的大部分内容)

There are a lot of things that might be wrong here, and Mathworks have actually set up a whole tutorial for how to troubleshoot this problem. (The title of the page is actually: Undefined variable "py" or function "py.command", so it should contain most of what you need)

查看以下内容:

  • 未安装Python
  • Windows平台上的
  • Python的64位/32位版本
  • MATLAB找不到Python
  • 用户定义的Python模块中的错误
  • Python模块不在Python搜索路径上
  • 模块名称冲突
  • Python尝试在错误的模块中执行命令
  • Python Not Installed
  • 64-bit/32-bit Versions of Python on Windows Platforms
  • MATLAB Cannot Find Python
  • Error in User-Defined Python Module
  • Python Module Not on Python Search Path
  • Module Name Conflicts
  • Python Tries to Execute command in Wrong Module

这篇关于“未定义的变量" py"或“类别"尝试从MATLAB R2014b加载Python时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆