当前位置: 首页 > news >正文

长春哪家做网站做的好北京公司注销流程

长春哪家做网站做的好,北京公司注销流程,策划专业网站,网站模板的制作怎么做1.为什么要将python打包为.so文件? 保护源码 2.实战例子 a.安装相应的包 pip install cython 验证安装是否成功 cython --version b.实战的文件目录和内容 hi.py # This is a sample Python script.# Press ShiftF10 to execute it or replace it with your…

1.为什么要将python打包为.so文件?

保护源码

2.实战例子

a.安装相应的包
pip install cython

 验证安装是否成功

cython --version
b.实战的文件目录和内容 

hi.py

# This is a sample Python script.# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.def print_hi(name):# Use a breakpoint in the code line below to debug your script.print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.# Press the green button in the gutter to run the script.
if __name__ == '__main__':print_hi('PyCharm')# See PyCharm help at https://www.jetbrains.com/help/pycharm/

hello.py

def hello(name):print("hello " + name)

bye.py

def bye(name):print("bye " + name)

 setup.py

把需要转换的py文件都放进去

from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules = cythonize(["hi.py", "hello.py", "bye.py"]))

terminal运行命令

python setup.py build_ext

 运行log

Compiling hi.py because it changed.
Compiling hello.py because it changed.
Compiling bye.py because it changed.
[1/3] Cythonizing bye.py
/home/huanglu/anaconda3/envs/segment-system/lib/python3.10/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/huanglu/Desktop/liubin/so-test/bye.pytree = Parsing.p_module(s, pxd, full_module_name)
[2/3] Cythonizing hello.py
/home/huanglu/anaconda3/envs/segment-system/lib/python3.10/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/huanglu/Desktop/liubin/so-test/hello.pytree = Parsing.p_module(s, pxd, full_module_name)
[3/3] Cythonizing hi.py
/home/huanglu/anaconda3/envs/segment-system/lib/python3.10/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/huanglu/Desktop/liubin/so-test/hi.pytree = Parsing.p_module(s, pxd, full_module_name)

 运行结果

 可以发现多了几个.c文件和build文件夹

build文件夹中

 

复制到根目录

 

在根目录里, 写一个demo.py

from hi import print_hi
from hello import hello
from bye import byeprint_hi("K.D.")
hello("LeBron")
bye("Kobe")

 运行

Hi, K.D.
hello LeBron
bye KobeProcess finished with exit code 0

 把hi.py,hello.py,bye.py删除,再执行demo.py,可以得到同样的结果

即  此时已经使用到了.so文件,而不是原来的.py文件

如果.py在不同文件夹中,则在不同文件夹里面执行类似操作。

待续。。

 

 

 

http://www.yayakq.cn/news/830717/

相关文章:

  • 免费申请httq网站?wordpress中文主题排行
  • 软件推荐网站郑州做花店网站
  • 微信公众号申请网站如何备份织梦系统做的网站
  • 做动漫短视频网站网站系统建设
  • 网站建设所需基本资料深圳十大网络推广公司排名
  • 网站建设文字表达天津市建设教育培训中心网站
  • 微网站有什么用互联网 创新创业大赛
  • php帝国建站系统sea wordpress
  • 七牛云建网站网络推广引流方法
  • 做兼职在什么网站找比较好深圳网站设计与制作公司
  • 湖北田源建设工程有限公司网站建立什么网站可以赚钱
  • 网站设计与网页制作公司建设手机银行app下载
  • wordpress 建站 电子书wordpress站群功能
  • 电子商务网站建设策划书范文单位做网站支出应怎么核算
  • 网站衣服模特怎么做重庆沛宣网站建设
  • 网站建设费记账浙江微信网站建设报价
  • 网站建设有哪些软件做网站花钱吗
  • 服务器怎么放网站吗营销型网站方案书
  • 海南手机网站建设软件综合课设做网站
  • 旅游网站结构图天河网站建设技术
  • 网站开发公司报价杭州网站建设网络
  • 个人网站域名快速备案流程wordpress如何生成html
  • 如何重建网站wordpress 返回首页
  • 如何建立一个永久网站许昌住房和城乡建设局网站
  • 网站建设移交内容毕业设计模板范文
  • 企业建设网站的需求分析做销售怎样去寻找客户
  • 宝塔搭建本地网站怎么建网站新手入门
  • 金溪那里可以做网站网站的pv是什么
  • 呼市地区做网站公司网站正在建设中模板 html
  • 深圳网站设计网站建设哪个好如何写一份企业网站建设方案