convert py to pyd

修改python安装目录下Lib\distutils\msvc9compiler.py文件

def get_build_version():
    return 9.0

def find_vcvarsall(version):
    return r'C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat'

简单写了一个测试文件(命名为test.py):

#coding:utf-8
2.def hello():
3.    print("Hello world")
4.    input("<press ENTER to quit>")

在该目录下,再新建一个py文件(命名为setup.py):

from distutils.core import setup
2.from Cython.Build import cythonize
3. 
4.setup(
5.  name = 'Hello world app',
6.  ext_modules = cythonize("test.py"),
7.)

python setup.py build_ext --inplace
posted @ 2017-09-22 15:42  idlewith  阅读(428)  评论(0编辑  收藏  举报