CommandError:您似乎没有' psql'程序已安装或在您的路径上 [英] CommandError: You appear not to have the 'psql' program installed or on your path

查看:66
本文介绍了CommandError:您似乎没有' psql'程序已安装或在您的路径上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows,没有virtualenv.我已经在Pip中安装了psycopg2,并且还安装了最新版本的PostgreSQL.

I'm using Windows, no virtualenv. I have psycopg2 installed with Pip, and the latest version of PostgreSQL installed as well.

当我运行 ./manage.py dbshel​​l 时,出现以下错误:

When I run ./ manage.py dbshell, I get the following error:

CommandError: You appear not to have the 'psql' program installed or on your path.

当我运行 ./manage.py dbshel​​l psql 时,我得到了:

When I run ./ manage.py dbshell psql, I get this:

usage: manage.py dbshell [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS]
                         [--pythonpath PYTHONPATH] [--traceback] [--no-color]
                         [--database DATABASE]
manage.py dbshell: error: unrecognized arguments: psql

我已经阅读了有关此错误的其他一些帖子,例如

I have read a few other posts on this error like this but I don't understand why this is not working for me. I have all the settings properly configured, and all the proper apps installed.

我的settings.py:

My settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'postgres',
        'USER': 'postgres',
        'PASSWORD': '********',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

我没有将Postgres的/bin文件夹添加到我的PATH中.我刚刚做了,它现在正在工作.多亏丹尼尔·罗斯曼(Daniel Roseman).

I did not add Postgres's /bin folder into my PATH. I just did it and it is working now. Thanks to Daniel Roseman.

推荐答案

在Windows中,我通过将其添加到PATH环境中来解决该问题:

In Windows I solved by adding this to PATH environment:

C:\ Program Files \ PostgreSQL \ 12 \ bin

然后重新启动终端和IDE

then restart terminals and IDEs

路径环境PATH

如何在Windows中的 Path 环境变量中添加文件夹

How to add a folder to Path environment variable in Windows

这篇关于CommandError:您似乎没有' psql'程序已安装或在您的路径上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆