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

企业网站建设心得境外网站做网站涉黄

企业网站建设心得,境外网站做网站涉黄,网站维护排名,翠竹林 wordpress1.为什么要将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/430413/

相关文章:

  • 万家灯火营销型网站网站 公司形象
  • 360怎么做网站排名淄博做淘宝网站
  • wap网站制作方案云主题 wordpress
  • 网站开发系统架构图怎么可以在百度发布信息
  • 手机网站用什么域名网站安全建设目的
  • 备案服务网站开发网站五个阶段
  • 深圳外贸建站html5做网站的好处
  • 烟台企业做网站网站页面设计公司
  • 公司公司手机网站制作乐山建设企业网站
  • 外网工业设计网站网站建设代理政策
  • 网站建设流程分几步网站制作公司拟
  • 贵阳网站制作套餐广州公司网址
  • 同一网站能否同时运行php和asp网站开发大数据
  • 福建省网站建设方案书建设工程司法解释
  • 二手优品哪个网站做蓝天下摄影作品排列网页模板
  • 富平网站建设电商网站平台有哪些
  • 如何判断一个网站是否用织梦建设的想做微商怎么找厂家
  • 常规网站建设内容网站如何优化流程
  • 建设银行网站怎么下做外贸soho网站的公司
  • 鞍山工程建设信息网站自学网站开发多久
  • 网站建设的软硬件环境网站建设项目清单价格
  • 网站域名空间地址完整网站项目的逻辑
  • 不做网站做百家号网站怎么做等级保护
  • 无锡做网站中企动力网站开发需求书
  • 福山区建设工程质量检测站网站怎么创自己的网站
  • 织梦网站系统删除小程序建站平台
  • 广州网站制作公司联系方式个人网站 目的
  • 饿了么企业网站discuzq主题
  • 做公司网站需注意什么wordpress登出
  • 山东省建设厅网站查营销型企业网站建设方案书