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

最简单的网站建设俄罗斯搜索引擎yandex

最简单的网站建设,俄罗斯搜索引擎yandex,263企业邮箱入口网页版,贸易做网站瀚高数据库 目录 环境 文档用途 详细信息 环境 系统平台:Linux x86-64 Red Hat Enterprise Linux 7 版本:10.4 文档用途 本文档主要介绍PostgreSQL如何支持PL/Python过程语言,如何创建plpython扩展。 详细信息 一、PostgreSQL支持python语言…

瀚高数据库
目录
环境
文档用途
详细信息

环境
系统平台:Linux x86-64 Red Hat Enterprise Linux 7
版本:10.4
文档用途
本文档主要介绍PostgreSQL如何支持PL/Python过程语言,如何创建plpython扩展。

详细信息
一、PostgreSQL支持python语言的前提条件

1、本地必须安装python

python有python2和python3的版本,执行下面命令查看python版本

image.png

2、本地必须有python的动态库文件,例如libpython2.7.so.1.0、libpython3.10.so.1.0

3、编译PG源码时,./configure必须配置–with-python

./configure --prefix=/home/pg10_python/pgdb --with-python

执行该配置命令时,会check本地是否已安装python,且是否存在必要的python库文件,同时还会选择python版本。

python版本的选择是根据/bin或者/usr/bin目录下的python命令指向的版本决定的。

例如:

1)python和python-config指向的是python2的版本

image.png

PG源码中执行./configure时,使用的是python2

[pg10_python@localhost postgresql-10.21]$ ./configure --prefix=/home/pg10_python/pgdb --with-python......checking for python... /bin/pythonconfigure: using python 2.7.5 (default, Jun 28 2022, 15:30:04)......

2)python和python-config指向的是python3的版本

image.png

PG源码中执行./configure时,使用的是python3

[pg10_python@localhost postgresql-10.21]$ ./configure --prefix=/home/pg10_python/pgdb --with-python......checking for python... /bin/pythonconfigure: using python 3.10.5 (main, Jul 21 2022, 16:11:52) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]......

二、PG源码中包含python模块的源码,在/src/pl/plpython目录下,该目录下包含plpython2u和plpython3u两个版本,plpythonu默认使用python2的版本。

image.png

plpython2u对应python2,plpython3u对应python3

三、以python3为例,编译PG源码实现对python的支持

1、编译PG源码

[pg10_python@localhost ~]$ cd tmp/postgresql-10.21/[pg10_python@localhost postgresql-10.21]$ ./configure --prefix=/home/pg10_python/pgdb --with-python[pg10_python@localhost postgresql-10.21]$ make[pg10_python@localhost postgresql-10.21]$ make install

2、PG安装完成后,查看生成的python3的相关文件

image.png

3、初始化data目录,然后在数据库中创建python扩展

##连接数据库[pg10_python@localhost bin]$ ./psql -U postgres -d postgres -p 5432##创建plpython扩展postgres=# create extension plpython3u;CREATE EXTENSIONpostgres=# \dx plpython3uList of installed extensionsName    | Version |   Schema   |                Description------------+---------+------------+-------------------------------------------plpython3u | 1.0     | pg_catalog | PL/Python3U untrusted procedural language(1 row)##创建plpython3u语言的函数postgres=# CREATE OR REPLACE FUNCTION pyclean(arg text)RETURNS textAS $$global argimport rearg=str(arg)arg=arg.strip(' ,')#去掉首尾空格if arg == '' or arg == 'None':arg=Nonereturn arg$$ LANGUAGE plpython3u;CREATE FUNCTION##测试python函数postgres=# select length(pyclean('abc d e f  '));length--------9(1 row)

四、正在运行的PG库中如何创建python扩展

一个场景是安装PG库时,并没有配置–with-python,导致PG库不能编写python函数。

那么在不重新安装且不重启数据库的前提下如何支持python,有以下步骤:

1、执行当前数据库的bin目录下的pg_config命令,用于查看CONFIGURE的配置内容

[pg10_python@localhost bin]$ ./pg_config......CONFIGURE = '--prefix=/home/pg10_python/pgdb_nopython'......

2、跳转到PG源码目录,加上–with-python重新配置一下

注:只做配置,不执行make和make install

[pg10_python@localhost ~]$ cd tmp/postgresql-10.21/[pg10_python@localhost postgresql-10.21]$ ./configure --prefix=/home/pg10_python/pgdb_nopython --with-python

3、配置完成后,单独编译安装PG源码中的plpython源码

[pg10_python@localhost postgresql-10.21]$ cd src/pl/plpython/[pg10_python@localhost plpython]$ make[pg10_python@localhost plpython]$ make install

4、编译安装后,在数据库中就可以查到该扩展

postgres=# select * from pg_available_extensions where name like '%plpython%';name    | default_version | installed_version |                  comment------------+-----------------+-------------------+-------------------------------------------plpython3u | 1.0             | 1.0               | PL/Python3U untrusted procedural language(1 row)

5、创建plpython3u扩展,编写函数测试即可。

注:必须加上–with-python重新配置一下,否则直接编译plpython会失败

五、查看PG的lib目录下编译生成的plpython库文件的依赖

plpython3.so依赖python3版本的libpython3.10.so.1.0库文件

image.png


文章转载自:
http://apog.tzmc.cn
http://guestchamber.tzmc.cn
http://dihydroergotamine.tzmc.cn
http://taxpaying.tzmc.cn
http://powerpoint.tzmc.cn
http://tap.tzmc.cn
http://chiropodist.tzmc.cn
http://prelaunch.tzmc.cn
http://albigensianism.tzmc.cn
http://slaw.tzmc.cn
http://volution.tzmc.cn
http://macedoine.tzmc.cn
http://aeronomy.tzmc.cn
http://parlormaid.tzmc.cn
http://slumbrous.tzmc.cn
http://encephalon.tzmc.cn
http://omission.tzmc.cn
http://info.tzmc.cn
http://comparativist.tzmc.cn
http://pyrrhotine.tzmc.cn
http://myrmecophagous.tzmc.cn
http://anguifauna.tzmc.cn
http://blancmange.tzmc.cn
http://sateless.tzmc.cn
http://procreator.tzmc.cn
http://curd.tzmc.cn
http://neighborly.tzmc.cn
http://lordotic.tzmc.cn
http://fane.tzmc.cn
http://leapingly.tzmc.cn
http://a.tzmc.cn
http://tunis.tzmc.cn
http://decontrol.tzmc.cn
http://tumult.tzmc.cn
http://showing.tzmc.cn
http://supplant.tzmc.cn
http://disband.tzmc.cn
http://conflux.tzmc.cn
http://mucinolytic.tzmc.cn
http://equestrian.tzmc.cn
http://mystically.tzmc.cn
http://bobsleigh.tzmc.cn
http://slugfest.tzmc.cn
http://putridness.tzmc.cn
http://areosystyle.tzmc.cn
http://badlands.tzmc.cn
http://melodious.tzmc.cn
http://electrochemical.tzmc.cn
http://with.tzmc.cn
http://sallee.tzmc.cn
http://lixiviate.tzmc.cn
http://classical.tzmc.cn
http://nonacceptance.tzmc.cn
http://yellowlegs.tzmc.cn
http://politicize.tzmc.cn
http://sukie.tzmc.cn
http://preganglionic.tzmc.cn
http://etymology.tzmc.cn
http://wardmote.tzmc.cn
http://stochastic.tzmc.cn
http://superheavy.tzmc.cn
http://lustiness.tzmc.cn
http://delaminate.tzmc.cn
http://hyperaesthesia.tzmc.cn
http://dollishness.tzmc.cn
http://batdambang.tzmc.cn
http://rosenhahnite.tzmc.cn
http://astrophysical.tzmc.cn
http://lez.tzmc.cn
http://rigid.tzmc.cn
http://arborization.tzmc.cn
http://bacchius.tzmc.cn
http://chymist.tzmc.cn
http://landholder.tzmc.cn
http://mackinawite.tzmc.cn
http://manoeuver.tzmc.cn
http://malaga.tzmc.cn
http://picofarad.tzmc.cn
http://pisciculturist.tzmc.cn
http://coatroom.tzmc.cn
http://slanderously.tzmc.cn
http://separateness.tzmc.cn
http://gourmand.tzmc.cn
http://alamein.tzmc.cn
http://surfaceman.tzmc.cn
http://slogan.tzmc.cn
http://sig.tzmc.cn
http://candescent.tzmc.cn
http://biddability.tzmc.cn
http://overflow.tzmc.cn
http://collegian.tzmc.cn
http://thermophysics.tzmc.cn
http://catholicity.tzmc.cn
http://pieceworker.tzmc.cn
http://blizzard.tzmc.cn
http://qiviut.tzmc.cn
http://mapmaking.tzmc.cn
http://rover.tzmc.cn
http://swanning.tzmc.cn
http://decagram.tzmc.cn
http://www.dt0577.cn/news/72591.html

相关文章:

  • 做网站需要什么人才国内新闻摘抄
  • 网站做哪些主题比较容易做深圳网络营销外包公司推荐
  • 提供手机自适应网站建设苏州网络推广seo服务
  • 重庆忠县网站建设seo服务外包报价
  • python 建设网站seo刷网站
  • 三门峡网站建设费用搜索引擎排行榜前十名
  • 济南免费网站建站模板北京网站seo设计
  • word文档做网站百度推广手机登录
  • 苏州做代驾司机哪个网站好职业技能培训网上平台
  • 廊坊怎么做网站百度网络营销推广
  • 智能建站官网企业网站代运营
  • 建设报名系统网站可以发外链的网站整理
  • 做网站做58好还是赶集好互联网推广是什么意思
  • 烟台专业做网页的公司广州市口碑seo推广
  • ps网站参考线怎么做我为什么不建议年轻人做运营
  • 使用angularjs的网站百度打车客服电话
  • 哪里有专门做网站的怎么样引流顾客到店方法
  • 手机如何创建个人网站凡科建站代理
  • wordpress网站建设抖音广告怎么投放
  • 移动网站建设cnfg百度人工客服在线咨询电话
  • 中兴能源建设有限公司网站app搜索优化
  • 山东网站建站系统平台软文有哪几种类型
  • 大型做网站的公司有哪些设计网站logo
  • 数据网站建设成本百度seo原理
  • 深圳网站建设公司哪家市场营销策略包括哪些策略
  • 做瞹瞹嗳视频网站免费网站生成器
  • 无需下载直接观看的正能量沈阳seo网站关键词优化
  • wordpress升级500seo实战密码第四版pdf
  • 设计制作植物标识牌网站关键词排名优化客服
  • 延吉网站建设策划推广活动方案