PostgreSQL:找不到命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3561855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PostgreSQL: command not found
提问by Tian
I installed PostgreSQL via MacPorts. However, going to /opt/local/lib/postgresql84/bin
I am unable to execute any of the pg commands. Does anyone know what I am doing wrong?
我通过 MacPorts 安装了 PostgreSQL。但是,转到/opt/local/lib/postgresql84/bin
我无法执行任何 pg 命令。有谁知道我做错了什么?
回答by Greg Hewgill
When you say "going to", it sounds like you're using the cd
command to change to that directory. Something like:
当您说“going to”时,听起来您正在使用该cd
命令切换到该目录。就像是:
$ cd /opt/local/lib/postgresql84/bin
$ psql
psql: command not found
Normally on Unix systems, the current directory is notpart of your executable search path. So either explicitly execute psql
from the current directory using ./
:
通常在 Unix 系统上,当前目录不是可执行文件搜索路径的一部分。因此,要么psql
使用./
以下命令从当前目录显式执行:
$ cd /opt/local/lib/postgresql84/bin
$ ./psql
or, add the directory to your PATH
:
或者,将目录添加到您的PATH
:
$ export PATH=/opt/local/lib/postgresql84/bin:$PATH
$ psql
回答by BarsMonster
Try this command:
试试这个命令:
find / -name psql
回答by ignacio chiazzo
I had installed postgres (Mac,The capitan SO) with the dmg and also I got the same issue. I had to install psql through brew. Try with this :
我已经用 dmg 安装了 postgres(Mac,The capan SO),我也遇到了同样的问题。我不得不通过 brew 安装 psql。试试这个:
brew install postgres
This worked for me.
这对我有用。
回答by Topera
Try
尝试
whereis psql