Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在windows上使用psycopg2连接到Postgres数据库时,脚本将保持运行 导入psycopg2 connection=psycopg2.connect(user=“postgres”, password=“postgres”, host=“127.0.0.1”, port=“5432”, dbname=“postgres”) 打印(“您已连接”)_Python_Postgresql - Fatal编程技术网

Python 在windows上使用psycopg2连接到Postgres数据库时,脚本将保持运行 导入psycopg2 connection=psycopg2.connect(user=“postgres”, password=“postgres”, host=“127.0.0.1”, port=“5432”, dbname=“postgres”) 打印(“您已连接”)

Python 在windows上使用psycopg2连接到Postgres数据库时,脚本将保持运行 导入psycopg2 connection=psycopg2.connect(user=“postgres”, password=“postgres”, host=“127.0.0.1”, port=“5432”, dbname=“postgres”) 打印(“您已连接”),python,postgresql,Python,Postgresql,我曾尝试使用python连接到Postgres数据库,但当我运行此脚本时,它会一直运行,不会返回任何错误。任何帮助,请,无法找出我做错了什么,我已经尝试搜索之前的答案没有结果。但是我可以通过psql或web界面进行连接,但不能将psycopg2与python一起使用。它是否打印了“您已连接”?你等待它做任何事情的最长时间是什么?您是否尝试过与其他东西连接,例如psql?一个多小时后Fine仍在运行?你是如何运行脚本的?

我曾尝试使用python连接到Postgres数据库,但当我运行此脚本时,它会一直运行,不会返回任何错误。任何帮助,请,无法找出我做错了什么,我已经尝试搜索之前的答案没有结果。但是我可以通过psql或web界面进行连接,但不能将psycopg2与python一起使用。

它是否打印了“您已连接”?你等待它做任何事情的最长时间是什么?您是否尝试过与其他东西连接,例如
psql
?一个多小时后Fine仍在运行?你是如何运行脚本的?