我刚刚安装了Postgressql(9.5.4 vc14_0)和Psycopg2(2.7.5 py36h74b6da3_0),我正试图在Windows 10的Anaconda环境中使用它们 .

每当我在python解释器中运行 psycopg2.connect("host=localhost user=postgres") 或在命令行上只运行 psql 时,我都会收到此错误:

无法连接到服务器:连接被拒绝(0x0000274D / 10061)服务器是否在主机“localhost”(127.0.0.1)上运行并接受端口5432上的TCP / IP连接?

I've looked at other Stackoverflow questions regarding this,一些答案说要查看一个pg_hba.conf文件,虽然我没有看到另一个使用我正在使用的Postgresql-Anaconda-Windows设置的SO问题 .

我也研究过services.msc但是没有看到关于postgresql的服务 .