繁体   English   中英

Geopandas 安装

[英]Geopandas Installation

我现在正在尝试在 Mac OS X 上安装 geopandas。

我做了什么:

在此处下载并安装适用于 Python 2.7 的 Anaconda。 图形安装程序。

python --version返回以下结果: Python 2.7.13 :: Anaconda 4.3.0 (x86_64)

• 使用此行安装geopandas: conda install -c conda-forge geopandas 据我了解,此命令还安装了所有其他必需的软件包。 这是安装的所有命令的列表:

click-plugins:   1.0.3-py27_0       conda-forge
cligj:           0.4.0-py27_0       conda-forge
descartes:       1.1.0-py27_0       conda-forge
expat:           2.1.0-2            conda-forge
fiona:           1.7.3-np111py27_0  conda-forge
freexl:          1.0.2-1            conda-forge
gdal:            2.1.3-np111py27_0  conda-forge
geopandas:       0.2.1-py27_3       conda-forge
geos:            3.5.1-1            conda-forge
giflib:          5.1.4-0            conda-forge
hdf4:            4.2.12-0           conda-forge
json-c:          0.12-0             conda-forge
kealib:          1.4.6-3            conda-forge
libdap4:         3.18.3-2           conda-forge
libnetcdf:       4.4.1.1-2          conda-forge
libpq:           9.5.4-3            conda-forge
libspatialindex: 1.8.5-1            conda-forge
libspatialite:   4.3.0a-14          conda-forge
munch:           2.1.0-py27_0       conda-forge
openjpeg:        2.1.2-2            conda-forge
pcre:            8.39-0             conda-forge
proj4:           4.9.3-2            conda-forge
psycopg2:        2.6.2-py27_1       conda-forge
pyproj:          1.9.5.1-py27_0     conda-forge
pysal:           1.13.0-py27_0      conda-forge
rtree:           0.8.3-py27_0       conda-forge
shapely:         1.5.17-np111py27_2 conda-forge
xerces-c:        3.1.4-0

• 当我运行conda list时会出现 geopandas

• 我在 test.py 中写了一些代码:

import geopandas as gpd

gpd.read_file("osm_mexico_city/mexico-city_mexico_roads.geojson")

问题:

• 当我在终端中运行 execute python test.py ,出现以下错误:

Traceback (most recent call last):
File "test.py", line 1, in <module>
import geopandas as gpd
File "//anaconda/lib/python2.7/site-packages/geopandas/__init__.py", line 4, in <module>
from geopandas.io.file import read_file
File "//anaconda/lib/python2.7/site-packages/geopandas/io/file.py", line 3, in <module>
import fiona
File "//anaconda/lib/python2.7/site-packages/fiona/__init__.py", line 69, in <module>
from fiona.collection import Collection, BytesCollection, vsi_path
File "//anaconda/lib/python2.7/site-packages/fiona/collection.py", line 9, in <module>
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: dlopen(//anaconda/lib/python2.7/site-packages/fiona/ogrext.so, 2): Library not loaded: @rpath/libpng16.16.dylib
Referenced from: //anaconda/lib/libgdal.20.dylib
Reason: Incompatible library version: libgdal.20.dylib requires version 45.0.0 or later, but libpng16.16.dylib provides version 44.0.0

• 我尝试的第二种方法是通过 PyCharm。 我已将项目解释器设置为 python 2.7。 有 geopandas 没有出现在包列表中,因此 PyCharm 甚至在此之前阻止:

    import geopandas as gpd
ImportError: No module named geopandas

希望任何人都知道如何解决这两个问题。

更新 1

安装 Anaconda brew doctor后,现在返回:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Anaconda is known to frequently break Homebrew builds, including Vim and
MacVim, due to bundling many duplicates of system and Homebrew-available
tools.

If you encounter a build failure please temporarily remove Anaconda
from your $PATH and attempt the build again prior to reporting the
failure to us. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
  //anaconda/bin/curl-config
  //anaconda/bin/dap-config
  //anaconda/bin/freetype-config
  //anaconda/bin/gdal-config
  //anaconda/bin/geos-config
  //anaconda/bin/icu-config
  //anaconda/bin/kea-config
  //anaconda/bin/libpng-config
  //anaconda/bin/libpng16-config
  //anaconda/bin/nc-config
  //anaconda/bin/pcre-config
  //anaconda/bin/python-config
  //anaconda/bin/python2-config
  //anaconda/bin/python2.7-config
  //anaconda/bin/xml2-config
  //anaconda/bin/xslt-config

似乎与这个问题有关。 我如何解决这些问题以使我的东西正常工作?

更新 2

我们可以忘记 PyCharm 问题,结果不知何故我有另一个 python 2.7,这就是他建议的那个。 我已将其更改为 Anaconda python 2.7,现在它给出了与终端输出相同的错误。

遇到了同样的问题,最后通过这个方法解决了这个:

  1. 首先使用 conda 安装 geopandas(这将安装所有依赖项)

    conda install -c conda-forge geopandas

  2. 卸载 Fiona

    康达卸载菲奥娜

  3. 下载菲奥娜轮和安装(我从这里下载https://pypi.python.org/packages/71/ea/908bf078499b30d1ec374eb5baba016a568fc8142ee6ccf72e356d20871c/Fiona-1.7.4-cp27-cp27m-macosx_10_6_intel.whl#md5=971393c23ffc552664b7c694b992fb3e

    pip 安装 Fiona-1.7.4-cp27-cp27m-macosx_10_6_intel.whl

  4. 重新安装 geopandas

    pip 安装 git+git://github.com/geopandas/geopandas.git

不确定 Anaconda 发生了什么,但事实证明依赖项不兼容。

conda install fiona=1.6

将 Fiona 降级到 1.6 为我解决了所有问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM