我知道在安装cartopy和底图之前需要满足一些依赖关系。我使用pip
(如numpy
等)对其中的大部分进行了整理。如何使用pip安装地图/绘图库cartopy和底图
我发现有一些cartopy问题与PROJ.4和一些底图问题与GEOS。 我认为python绑定到Java项目Proj.4已经足够了,我有点与C++库GEOS丢失了(我认为GDAL对于GEOS已经足够了,我已经将它与Python世界联系起来了:pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version
)。
我宁愿避免像蟒蛇,雨棚等 所有这些事情,如果可能的话,我想只有pip
两个Ubuntu的使用(apt-get
,只要pip
是不够的)和Mac OSX(自制例如brew install <some_package>
,只如果pip
是不够的)。
cartopy卡住了Proj.4的版本太旧了。 pip
输出说:Proj4 version 4.8.0 is installed, but cartopy requires at least version 4.9.0.
。 我是假设这个pip
安装Python绑定的已经足够了,但它并没有解决问题:
$ pip show pyproj
Name: pyproj
Version: 1.9.5.1
Summary: Python interface to PROJ.4 library
Home-page: https://github.com/jswhit/pyproj
Author: Jeff Whitaker
Author-email: [email protected]
License: OSI Approved
Location: /usr/local/lib/python2.7/dist-packages
Requires:
我不知道为什么Python绑定到PROJ.4是不够的,即使这些绑定是可用的最新版本,使用pip
。
底图卡在不同的方式:
- 使用
pip2 install basemap
不知何故,我得到Could not find a version that satisfies the requirement basemap (from versions:) No matching distribution found for basemap
但随后从底图文档我发现库未链接到
pip
库因为某些原因和需要从源代码安装。所以,我已经运行:pip2 install https://github.com/matplotlib/basemap/archive/v1.0.7rel.tar.gz
,我相信,一个GEOS
编译的C++代码被触发,一段时间后,在底部此站:In file included from src/_geoslib.c:255:0: /usr/include/geos_c.h:151:22: note: expected ‘GEOSMessageHandler’ but argument is of type ‘void (*)(char *, char *)’ extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function, ^ x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/_geoslib.o -lgeos_c -lgeos -o build/lib.linux-x86_64-2.7/_geoslib.so /usr/bin/ld: cannot find -lgeos collect2: error: ld returned 1 exit status /usr/bin/ld: cannot find -lgeos collect2: error: ld returned 1 exit status error: Command "x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/_geoslib.o -lgeos_c -lgeos -o build/lib.linux-x86_64-2.7/_geoslib.so" failed with exit status 1 ---------------------------------------- Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-QVrKRr-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-EgAOPT-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-QVrKRr-build/
我不知道我在做什么错误:
- 如何提供正确的Proj.4东西到cartopy?实际上,我宁愿找到一个较旧的版本,对现有版本的Proj.4(我假设它来自
pip install
绑定)有效, - 如何从我设置的GDAL链接中获取底图映射
pip
?如果这还不够,那我应该做些什么?也许一些GEOS封装的某些apt-get
可以避免在底图安装中触发GEOS编译?
我有点困惑,在这个没有男人的土地之间的Java二进制文件,C++二进制文件和绑定到Python包。
这确实安装了proj4,但对我来说它拉4.8.0不4.9.0 – Daniel
@Daniel我已更新条目。 –