在OSX上缺少libgeos_c.so [英] missing libgeos_c.so on OSX
问题描述
我正在尝试安装Postgis以便在OSX上使用GeoDjango.
I am trying to install Postgis in order to use GeoDjango on OSX.
为此,我首先完全卸载了postgres,然后按照GeoDjango文档安装了所有内容:
For this, I first uninstalled postgres completely, then I installed everything following the GeoDjango documentation: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#homebrew
我做了以下事情:
brew update
brew upgrade
brew install postgresql
brew install postgis
brew install gdal
brew install libgeoip
当我运行Django项目时,出现以下错误:
When I run my Django project, I get the following error:
OSError at / dlopen(/usr/local/lib/libgeos_c.so, 6): image not found
我跑了
sudo find . -name "libgeos_c*"
得到了:
./Library/Frameworks/GEOS.framework/Versions/3/unix/lib/libgeos_c.dylib
./Users/martin/opt/geos-3.3.0/capi/.deps/libgeos_c_la-geos_c.Plo
./Users/martin/opt/geos-3.3.0/capi/.deps/libgeos_c_la-geos_ts_c.Plo
./usr/local/Cellar/geos/3.3.3/lib/libgeos_c.1.dylib
./usr/local/Cellar/geos/3.3.3/lib/libgeos_c.a
./usr/local/Cellar/geos/3.3.3/lib/libgeos_c.dylib
./usr/local/Cellar/geos/3.3.4/lib/libgeos_c.1.dylib
./usr/local/Cellar/geos/3.3.4/lib/libgeos_c.a
./usr/local/Cellar/geos/3.3.4/lib/libgeos_c.dylib
./usr/local/Cellar/geos/3.3.5/lib/libgeos_c.1.dylib
./usr/local/Cellar/geos/3.3.5/lib/libgeos_c.a
./usr/local/Cellar/geos/3.3.5/lib/libgeos_c.dylib
./usr/local/lib/libgeos_c.1.dylib
./usr/local/lib/libgeos_c.a
./usr/local/lib/libgeos_c.dylib
如您所见,根本没有".so"文件.有什么建议吗?
As you can see, no ".so" files at all. Any suggestions?
出于绝望,我还安装了KyngChaos软件包并添加了以下设置:
Out of desperation I also installed the KyngChaos Packages and added the following settings:
GEOS_LIBRARY_PATH = '/Library/Frameworks/GEOS.framework/GEOS'
GDAL_LIBRARY_PATH = '/Library/Frameworks/GDAL.framework/GDAL'
GEOIP_LIBRARY_PATH = '/usr/local/Cellar/geoip/1.4.8/lib/libGeoIP.dylib'
这解决了问题.
推荐答案
很抱歉,KyngChaos解决方案完全无法达到使用自制软件的目的.
Sorry, that KyngChaos solution completely defeats the purpose of using homebrew.
自制软件用户的答案(至少对此是这样)是卸载 geos
及其依赖项,然后然后重新安装 geos
然后是其依赖项.
The answer for homebrew users (at least, for this one) is to uninstall geos
and its dependencies and then reinstall geos
and then its dependencies.
这对我有用:
brew uninstall geos gdal geoip libspatialite librasterlite spatialite-gui spatialite-tools
brew cleanup
brew install geos
brew install gdal geoip libspatialite librasterlite spatialite-gui spatialite-tools
brew cleanup
似乎某些 geos
依赖关系不同步.
It seems some geos
dependencies are getting out of sync.
您可以通过跟踪返回的内容验证需要安装的库:
You can verify the libraries that need to be installed by tracking what this returns:
python -c 'import _ctypes; _ctypes.dlopen("/usr/local/lib/libgdal.dylib")'
您会看到类似的东西
Reason: Incompatible library version: [some geos dependent library].dylib requires version X.X.X or later, but libgeos_c.1.8.0.dylib provides version X.X.X.
brew uninstall [some geos dependency]
brew install [some geos dependency]
brew cleanup
然后重新运行上面的 python
命令,该问题将得到解决,或者会显示出另一个要卸载/安装的依赖项.
Then rerun the above python
command and either the problem will be resolved or it'll reveal another dependency to uninstall/install.
这篇关于在OSX上缺少libgeos_c.so的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!