win10、py3.7、64位 vs2015
demo |–my_lib.py |–read.txt |–run.py |–to_pyd.py
my_lib.py
import pandas as pd def fun1(): print('\nthis is my_lib.fun1') data = {'a': [1, 2, 3], 'b': ['a', 'b', 'c']} df = pd.DataFrame(data) print(df) with open('read.txt')as f: a = f.readlines() print('read file:', a) return Trueread.txt
a b crun.py
from my_lib import fun1 fun1() input('按任意键退出!')to_pyd.py
from distutils.core import setup from Cython.Build import cythonize # name随便写,py文件为要编译的文件 setup(name='api_sign', ext_modules=cythonize('my_lib.py', compiler_directives={'language_level': 3}))–clean:在本次编译开始时,清空上一次编译生成的各种文件。
