我通过MacPorts安装了PostgreSQL。但是,当我进入/opt/local/lib/postgresql84/bin
时,我无法执行任何pg命令。有人知道我做错了什么吗?
我通过MacPorts安装了PostgreSQL。但是,当我进入/opt/local/lib/postgresql84/bin
时,我无法执行任何pg命令。有人知道我做错了什么吗?
当你说“去到”时,听起来像是在使用cd
命令切换到那个目录。例如:
$ cd /opt/local/lib/postgresql84/bin
$ psql
psql: command not found
通常在Unix系统中,当前目录不是可执行程序的搜索路径的一部分。因此,可以使用./
来显式地从当前目录执行psql
:
$ cd /opt/local/lib/postgresql84/bin
$ ./psql
或者,将该目录添加到您的PATH
中:
$ export PATH=/opt/local/lib/postgresql84/bin:$PATH
$ psql
我曾使用dmg安装了postgres (Mac,The capitan SO),但是遇到了同样的问题。后来我通过brew安装了psql。你可以尝试以下步骤:
brew install postgres
尝试执行此命令:
find / -name psql
尝试
whereis psql