'shp2pgsql'无法识别:找不到命令错误

时间:2014-03-31 18:53:47

标签: postgresql postgis

我正在尝试将形状文件导入到postgis。我在配置shp2pgsql时遇到问题。

我收到此错误:

-bash: shp2pgsql: command not found

我已经阅读了不同的帖子而没有得到任何结果,例如:https://github.com/Homebrew/homebrew/issues/19213

macbook$ locate shp2pgsql
/Library/PostgreSQL/9.3/PostGIS/man/shp2pgsql.1
/Library/PostgreSQL/9.3/bin/shp2pgsql
/usr/bin/shp2pgsql

macbook$ otool -L shp2psql
otool: can't open file: shp2psql (No such file or directory)

我试图运行哪个命令

macbook$ which shp2pgsql

我一无所获。

 macbook$ ls /usr/bin/shp2pgsql
/usr/bin/shp2pgsql

首先猜测是" shp2pgsql"没有联系。当我试图运行时,如何在postgres PostgreSQL中链接/ usr / bin / shp2pgsql:

sudo ln -s /Library/PostgreSQL/9.3/bin/shp2pgsql  /usr/bin/shp2pgsql
It says that : : ln: /usr/bin/shp2pgsql: File exists

更新 当我链接shp2pgsql

dyld: Library not loaded: @loader_path/../lib/liblwgeom-2.1.1.dylib
  Referenced from: /Library/PostgreSQL/9.3/bin/shp2pgsql
  Reason: image not found

当我试图找到liblwgeom

macbook$ locate liblwgeom
/Library/Caches/Homebrew/Formula/liblwgeom.brewing
/Library/Caches/Homebrew/liblwgeom-2.1.1.tar.gz
/Library/PostgreSQL/9.3/lib/postgresql/liblwgeom-2.1.1.dylib
/Library/PostgreSQL/9.3/lib/postgresql/liblwgeom.a
/Library/PostgreSQL/9.3/lib/postgresql/liblwgeom.dylib
/Library/PostgreSQL/9.3/lib/postgresql/liblwgeom.la
/usr/local/Cellar/liblwgeom
/usr/local/Cellar/liblwgeom/2.1.1
/usr/local/Cellar/liblwgeom/2.1.1/COPYING
/usr/local/Cellar/liblwgeom/2.1.1/ChangeLog
/usr/local/Cellar/liblwgeom/2.1.1/INSTALL_RECEIPT.json
/usr/local/Cellar/liblwgeom/2.1.1/LICENSE.TXT
/usr/local/Cellar/liblwgeom/2.1.1/NEWS
/usr/local/Cellar/liblwgeom/2.1.1/TODO
/usr/local/Cellar/liblwgeom/2.1.1/include
/usr/local/Cellar/liblwgeom/2.1.1/include/liblwgeom.h
/usr/local/Cellar/liblwgeom/2.1.1/lib
/usr/local/Cellar/liblwgeom/2.1.1/lib/liblwgeom-2.1.1.dylib
/usr/local/Cellar/liblwgeom/2.1.1/lib/liblwgeom.a
/usr/local/Cellar/liblwgeom/2.1.1/lib/liblwgeom.dylib
/usr/local/Library/Formula/liblwgeom.rb
/usr/local/opt/liblwgeom

有任何想法如何解决这个问题。

1 个答案:

答案 0 :(得分:1)

在bash控制台中编写echo $ PATH并告诉我们它的内容。 可能这可以通过

来解决
PATH=$PATH:/Library/PostgreSQL/9.3/bin/
export PATH