2024-04-28 19:35:26 发布
网友
在google上,我找到了关于PyGreSQL库的文档,这些文档可以帮助我将Python连接到Postgres。在
但是,我找不到任何地方下载包的链接。即使是这份文件: http://www.pygresql.org/install.html
谈论下载Windows安装程序等,但不知道从哪里下载。在
我想让这个连接适用于python2.7
从python开发PostgreSQL的最经典、最有文档记录的库可能是psycopg2,它可以在windows上下载here。 如果您特别想要PyGreSQL,下载页面是here。在
pypi https://pypi.python.org上列出了不属于标准库的Python模块。 例如,pygresql模块列在下一页中: https://pypi.python.org/pypi/PyGreSQL/
您还可以在页面中看到上次更新包的时间(在本例中是2013年),因此您可以使用psycopg2这样的替代方法来使用python连接到postgresql https://pypi.python.org/pypi/psycopg2
步骤1:pip安装psycopg2
第二步:下面的用户代码:-在
import psycopg2 connection = psycopg2.connect(database="dbname", user="username", password="pass", host="hostname", port=5432) cursor = connection.cursor() cursor.execute("SELECT * from portal.portal_users;") # Fetch all rows from database record = cursor.fetchall() print("Data from Database:- ", record)
从python开发PostgreSQL的最经典、最有文档记录的库可能是psycopg2,它可以在windows上下载here。 如果您特别想要PyGreSQL,下载页面是here。在
pypi https://pypi.python.org上列出了不属于标准库的Python模块。 例如,pygresql模块列在下一页中: https://pypi.python.org/pypi/PyGreSQL/
您还可以在页面中看到上次更新包的时间(在本例中是2013年),因此您可以使用psycopg2这样的替代方法来使用python连接到postgresql https://pypi.python.org/pypi/psycopg2
步骤1:pip安装psycopg2
第二步:下面的用户代码:-在
相关问题 更多 >
编程相关推荐