Python使用com接口时的错误

TypeError: This COM object can not automate the makepy process - please run makepy manually for this object
这是因为python读取不到COM的相关接口信息,所有需要我们手动去执行makepy来生成它们。

There is, however, a technique automation objects use to publish their object model in a type library. Type libraries define a set of interfaces a program can use to determine both the methods and properties themselves, and other useful information, such as the type of the parameters or return values. Languages or environments may be capable of using this information at compile-time to provide a better interface to the objects.
The typelib – A TLB, DLL, OCX or anything containing COM type information.
If a typelib is not specified, a window containing a textbox will open from which you can select a registered type library.

To generate a MakePy file at runtime, you need to know the unique ID of the type library (a CLSID) and its version and language identifier.
This information is usually not easy to find, so the MakePy module supports a convenient method to
obtain this information.

MakePy -i 
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MATLAB 的 "Python" 接口可以让用户在 MATLAB 中调用 Python 代码和库。使用 "Python" 接口需要先安装 Python 并配置 MATLAB 的 Python 环境。以下是使用 MATLAB 的 "Python" 接口的一些基本步骤: 1. 安装 PythonMATLAB 中使用 "Python" 接口需要先安装 Python。可以从 Python 官网(https://www.python.org/downloads/)下载安装包并安装。 2. 配置 MATLAB 的 Python 环境 在 MATLAB 中使用 "Python" 接口需要将 MATLAB 的 Python 环境配置为已安装的 Python 版本。可以使用以下命令查看当前 Python 版本: ``` pyversion ``` 如果当前版本不是已安装的 Python 版本,可以使用以下命令设置 MATLAB 的 Python 环境: ``` pyversion /path/to/python ``` 其中,"/path/to/python" 是 Python 安装路径。 3. 打开 "Python" 终端 在 MATLAB 命令窗口中输入以下命令打开 "Python" 终端: ``` py ``` 打开 "Python" 终端后就可以在其中输入 Python 代码并执行。 4. 调用 Python 库 在 "Python" 终端中可以使用 "import" 命令导入 Python 库,并使用 "py." 前缀调用其中的函数。例如,导入 NumPy 库并使用其中的函数可以使用以下命令: ``` import numpy as np a = py.numpy.array([1,2,3]) b = py.numpy.sqrt(a) ``` 在以上代码中,"py." 前缀用于调用 NumPy 库中的函数,而不是调用 MATLAB 中的函数。 需要注意的是,使用 "Python" 终端需要先将当前工作目录切换到 MATLAB 工作目录下,否则可能会导致文件读取错误等问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值