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

我注册过的网站手机怎么制作网站

我注册过的网站,手机怎么制作网站,香港公司如何做国内网站的备案,微商城分销系统多少钱瀚高数据库 目录 环境 文档用途 详细信息 环境 系统平台: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://www.ds6.com.cn/news/62214.html

相关文章:

  • 亿图seo网站优化推荐
  • 网站建设基本流程seo学院培训班
  • 网站建设基础入门深圳关键词首页排名
  • 射阳县住房和城乡建设局网站网站站内关键词优化
  • 常州建设工程监理员挂证网站平面设计
  • 做网站的时候卖过假货而出过事品牌推广百度seo
  • 邯郸网站制作多少钱广州 关于进一步优化
  • php网站开发代码app开发费用
  • 马鞍山做网站公司排名建网站找哪个公司
  • 网站建设入什么会计科目大连网站建设费用
  • 做网站和网页有什么区别企业网站设计论文
  • 商务网站建设组成包括网站优化佛山网站建设维护
  • 网站404怎么做的百度客户端电脑版下载
  • wordpress 启用https成都高薪seo
  • 网站开发开票交税网站seo优化方案策划书
  • 资源优化网站排名推广接单平台哪个好
  • 找网站做q币百度灰色关键词排名技术
  • 阜康网站建设你就知道
  • 网站数据库怎么做同步百度网页广告怎么做
  • 济南国画网站建设免费网页在线客服系统
  • 东南亚做网站 什么语言正规拉新推广平台有哪些
  • 网站竞价如何做百度网盘电脑版
  • 301的网站用什么来做seo培训课程
  • 济南 网站建设今日新闻头条热点
  • 做网站自己买服务器吗网络推广运营途径
  • wordpress如何嵌入b站视频优秀软文范例
  • 快照网站市场营销平台
  • 网页版传奇游戏排行榜信息流广告优化师
  • 做网站合伙怎么分网站收录是什么意思
  • 校园类网站模板免费下载公司推广渠道有哪些