如何重建Python模块/库 [英] How to rebuild a Python module/library

查看:80
本文介绍了如何重建Python模块/库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试按照此答案此处中所述重建pyhook库.

I'm trying to rebuild the pyhook libary as described in this answer here.

基本上,我需要为pyhook模块更改几行C代码.

Basically, I need to change a few lines of the C code for the pyhook module.

问题是我不知道如何访问C代码或如何重建库.

The problem is I don't know how to access the C code or how to rebuild the libary.

我听说过Cython,但我不了解,也不知道如何使用它.

I've heard of Cython but I don't understand it and I don't know how to use it.

此外,我希望该解决方案与py2exe兼容.

Also, I would like the solution to be compatible with py2exe.

推荐答案

您需要先下载C代码-这不是exe安装的一部分.解压缩它,然后您将拥有一个将要构建的源树.

You need to download the C code first - it's not part of the exe install. Unzip it and you then have a source tree that will build.

要构建它,您将需要C编译器.您需要使用SAME ONE作为平台的Python版本.例如,对于Windows和Python 3.5,您需要Microsoft的最新Visual C.

To build it you'll need a C compiler. You need to use the SAME ONE as your Python version for your platform. For example, for Windows and Python 3.5 you need the latest Visual C from Microsoft.

对于pyHook,您还需要SWIG.用它从提供的cpyHook.i构造cpyHook_wrap.c

For pyHook you also need SWIG. Use that to construct cpyHook_wrap.c from the supplied cpyHook.i

然后运行setup.py,您应该会很好.

Then run setup.py and you should be good to go.

这篇关于如何重建Python模块/库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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