python 扩展方法_vc6编写python扩展的方法分享

本文介绍如何在VC6环境下编译Python-2.5.4的动态链接库。通过详细步骤展示了从下载源码、配置环境到最终编译成功的全过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

系统环境:VC6 + Python-2.5.4

1、下载Python-2.5.4源码。

2、解压,打开D:\Python-2.5.4\PC\VC6\pcbuild.dsw,编译,D:\Python-2.5.4\PC\VC6\下得到python25.dll、python25_d.dll、python25.lib、python25_d.lib。

3、使用VC6建立一个动态链接库工程,拷贝D:\Python-2.5.4\PC\example_nt\example.c到工程目录下,并添加到工程中。

4、设置工程。

打开tools->options->directories,添加D:\PYTHON-2.5.4\INCLUDE 到 includes files中,添加D:\PYTHON-2.5.4\PC\VC6 到 Library files中。

打开Progect->Settings,将Win32 Debug->Link->Output file name修改为example_d.pyd,将Win32 Release->Link->Output file name修改为example.pyd

5、编译。

6、尝试调用:

D:\MY Project\testpymodule\Release>python

Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on

win32

Type "help", "copyright", "credits" or "license" for more information.

>>> import example

>>> example.foo()

Hello, world

>>>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值