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

西安免费公司网站制作wordpress 别名获取id

西安免费公司网站制作,wordpress 别名获取id,广州企业网站设计方案,邯郸网站制作外包前提条件#xff1a; 确保电脑已经安装gcc且终端能检索到确保Python中已经安装cython包#xff0c;若未安装#xff0c;则先使用pip install cython进行安装 打包方法#xff1a; step1#xff1a;编写编译脚本setup.py#xff0c;代码如下#xff1a; # encoding ut…前提条件 确保电脑已经安装gcc且终端能检索到确保Python中已经安装cython包若未安装则先使用pip install cython进行安装 打包方法 step1编写编译脚本setup.py代码如下 # encoding utf-8 from distutils.core import setup from Cython.Build import cythonize setup( name libname, ext_modules cythonize([file1.py, file2.py, dir/file3.py], language_level 3) )step2终端中执行: python3 setup.py build_ext需要注意的点 setup()中的ext_modules不是exe_modules千万不要打错了如果打错了你会发现只编译成了.c文件而没用生成.so生成的.so只能在打包计算机相同系统、相同平台及相同python版本环境下使用要想在其他平台或环境下使用需要在指定平台或环境下重新打包存在多个python版本时如在linux下博主python2和python3共存需要指定编译用的python版本否则终端会报警告FutureWarning: Cython directive ‘language_level’ not set, using 2 for now (Py2)。指定版本有两种方式 method 1: 在每个要打包的py文件头部写入# cython:language_level3 method 2: 像上述setup.py中一样在cythonize函数中加入language_level 3选项 打包完的.so文件结构会被打乱如上述dir中的file3.py生成的file3.so与其他两个同目录而不是在dir文件夹下如果不做调整执行脚本时可能存在import错误因此还要手动调整一下文件结构 附批量打包的代码 import os import sys import shutil import numpy import tempfilefrom setuptools import setup from setuptools.extension import Extensionfrom Cython.Build import cythonize from Cython.Distutils import build_ext import platform# code from: https://blog.csdn.net/qq_33375598/article/details/118677130# 构建后存放的文件目录 build_root_dir build/lib. platform.system().lower() - platform.machine() - str(sys.version_info.major) . str(sys.version_info.minor)print(build_root_dir)extensions [] ignore_folders [build, test, tests] conf_folders [conf]def get_root_path(root):if os.path.dirname(root) in [, .]: # 得到文件的文件路径return os.path.basename(root) # 返回path最后的文件名else:return get_root_path(os.path.dirname(root))def copy_file(src, dest):if os.path.exists(dest): # 目的文件存在返回returnif not os.path.exists(os.path.dirname(dest)): # 目的文件夹不存在递归创建文件夹os.makedirs(os.path.dirname(dest))if os.path.isdir(src): # 判断某一路径是否为目录shutil.copytree(src, dest) # 拷贝整个文件夹(目的文件夹需要不存在否则会失败)else:shutil.copyfile(src, dest) # 拷贝整个文件def touch_init_file(): # 在临时文件夹中创建initinit_file_name os.path.join(tempfile.mkdtemp(), __init__.py)with open(init_file_name, w):passreturn init_file_nameinit_file touch_init_file() print(init_file)def compose_extensions(root.):for file_ in os.listdir(root): # 当前目录下的所有文件abs_file os.path.join(root, file_) # 路径拼接if os.path.isfile(abs_file):if abs_file.endswith(.py):extensions.append(Extension(get_root_path(abs_file) .*, [abs_file]))elif abs_file.endswith(.c) or abs_file.endswith(.pyc):continueelse:copy_file(abs_file, os.path.join(build_root_dir, abs_file))if abs_file.endswith(__init__.py): # 用空白的__init__.py替代原有的copy_file(init_file, os.path.join(build_root_dir, abs_file))else:if os.path.basename(abs_file) in ignore_folders: # 忽略的文件不拷贝continueif os.path.basename(abs_file) in conf_folders: # 配置文件一同拷贝copy_file(abs_file, os.path.join(build_root_dir, abs_file))compose_extensions(abs_file)compose_extensions() os.remove(init_file)setup(nameyour_project_name,version1.0,ext_modulescythonize(extensions,nthreads16,compiler_directivesdict(always_allow_keywordsTrue),include_path[numpy.get_include()], language_level3),cmdclassdict(build_extbuild_ext))参考链接 https://blog.csdn.net/qq_33375598/article/details/118677130https://blog.csdn.net/weixin_36755535/article/details/127300870
http://wiki.neutronadmin.com/news/16997/

相关文章:

  • 石城网站建设闪灵企业建站系统
  • 网站建设容易学吗外国人做的篆字网站
  • 焦作整站优化权威的南通网站建设
  • 家具建设网站锡林郭勒盟建设厅官方网站
  • 网站建设 别墅有什么好的设计网站
  • 微信平台微网站开发昆明网站推广排名
  • 上海网站建设q.479185700棒做网页网站
  • 网站多语切换怎么做wordpress完美主题模板
  • 婚纱影楼网站免费源码热搜词排行榜
  • 做网站对客户有什么帮助主流网站开发技术框架
  • wordpress的vps建站流程网站功能需求分析文档
  • 网站结构分类wordpress动态cdn
  • 免费网站成品湖南手机网站制作公司
  • 石家庄网站建设燕杰做网站配置好了找不到服务器
  • 建设银行网站在哪设置查询密码外贸业务员做网站
  • 大学生做网站兼职免费刷粉网站推广
  • 自己的网站怎么做进销存营销型网站开发推广
  • 男女做暖暖视频网站vue做网站cms
  • 电子商务网站开发怎么设计铜仁做网站的公司
  • 广州网站建设方案淘宝客怎么建设网站
  • 安徽建设工程信息网新网站哪儿登陆内蒙古建设工程交易中心网站
  • 视频网站数据库设计知春路网站建设公司
  • rtt全民互助平台网站开发韩国vs加纳分析比分
  • 陕西做教学成果网站的公司青岛外贸网站推广
  • 建网站做站长网站里的地图定位怎么做
  • 吉安建站公司哪家做网站
  • 学生处网站建设招标公告电视直播网站开发
  • 祁东网站建设制作网站的手机软件
  • 网站宣传与推广的指导思想做视频必须知道的一些网站
  • 寻找郑州网站建设公司永久的海外域名