CommandError:您似乎没有' psql'程序已安装或在您的路径上 [英] CommandError: You appear not to have the 'psql' program installed or on your path
问题描述
我正在使用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 dbshell
时,出现以下错误:
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 dbshell 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
How to add a folder to Path
environment variable in Windows
这篇关于CommandError:您似乎没有' psql'程序已安装或在您的路径上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!