python导入dll_Python DLL扩展导入

我为我的Python创建了扩展并创建了一个abcPython.dll.如何将此dll导入我的Python脚本?

当我尝试使用以下命令导入它时收到错误消息

>>>import abcPython

>>>Traceback (most recent call last):

File "", line 1, in

ImportError: No module named abcPython

>>>

我手动创建了一个名为PYTHONPATH的系统环境变量,它存储了abcPython.dll的路径,但仍然存在错误.

我怎样才能解决这个问题?

解决方法:

The output file should be called spam.pyd (in Release mode) or spam_d.pyd (in Debug mode). The extension .pyd was chosen to avoid confusion with a system library spam.dll to which your module could be a Python interface

Changed in version 2.5: Previously, file names like spam.dll (in release mode) or spam_d.dll (in debug mode) were also recognized.

尝试重命名您的DLL以使用.pyd扩展名而不是.dll.

引用指向C example,它明确包含INIT函数,

PyMODINIT_FUNC initexample(void).生成的DLL应重命名为example.pyd:

#include "Python.h&

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值