成功安装 conda 后无法导入 Geopandas

时间:2021-01-05 21:33:25

标签: import module geopandas

我觉得很愚蠢,因为我似乎无法导入 geopandas。

我正在使用 Anaconda (miniconda3) 并且感觉我已经通过以下方式成功安装:

(base) C:\Users\Jeremy>Conda create -n geopandas_env
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\Jeremy\miniconda3\envs\geopandas_env



Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate geopandas_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate


(base) C:\Users\Jeremy>Conda activate geopandas_env

(geopandas_env) C:\Users\Jeremy>conda install python=3 geopandas
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\Jeremy\miniconda3\envs\geopandas_env

  added / updated specs:
    - geopandas
    - python=3


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    attrs-20.3.0               |     pyhd3eb1b0_0          43 KB
    blas-1.0                   |              mkl           6 KB
    bzip2-1.0.8                |       he774522_0         113 KB
    cfitsio-3.470              |       he774522_6         512 KB
    click-7.1.2                |             py_0          71 KB
    click-plugins-1.1.1        |             py_0          12 KB
    cligj-0.7.1                |   py38haa95532_0          14 KB
    curl-7.67.0                |       h2a8f88b_0         123 KB
    expat-2.2.10               |       h33f27b4_2         187 KB
    fiona-1.8.13.post1         |   py38hd760492_0         619 KB
    freexl-1.0.6               |       h2bbff1b_0          51 KB
    gdal-3.0.2                 |   py38hdf43c64_0         1.0 MB
    geopandas-0.8.1            |             py_0         902 KB
    geos-3.8.0                 |       h33f27b4_0         905 KB
    geotiff-1.5.1              |       h5770a2b_1         126 KB
    hdf4-4.2.13                |       h712560f_2         1.3 MB
    hdf5-1.10.4                |       h7ebc959_0         7.9 MB
    icc_rt-2019.0.0            |       h0cc432a_1         6.0 MB
    icu-58.2                   |       ha925a31_3         9.4 MB
    intel-openmp-2020.2        |              254         1.6 MB
    jpeg-9b                    |       hb83a4c4_2         245 KB
    kealib-1.4.7               |       h07cbb95_6         133 KB
    krb5-1.16.4                |       hc04afaa_0         693 KB
    libboost-1.67.0            |       hd9e427e_4        18.6 MB
    libcurl-7.67.0             |       h2a8f88b_0         269 KB
    libgdal-3.0.2              |       h1155b67_0         7.0 MB
    libiconv-1.15              |       h1df5818_7         626 KB
    libkml-1.3.0               |       he5f2a48_4        19.7 MB
    libnetcdf-4.6.1            |       h411e497_2         494 KB
    libpng-1.6.37              |       h2a8f88b_0         333 KB
    libpq-11.2                 |       h3235a2c_0         2.6 MB
    libspatialindex-1.9.3      |       h33f27b4_0         351 KB
    libspatialite-4.3.0a       |       h7ffb84d_0         2.3 MB
    libssh2-1.9.0              |       h7a1dbc1_1         215 KB
    libtiff-4.1.0              |       h56a325e_0         737 KB
    libxml2-2.9.10             |       hb89e7f3_3         1.5 MB
    lz4-c-1.8.1.2              |       h2fa13f4_0         176 KB
    m2w64-expat-2.1.1          |                2         160 KB
    m2w64-gcc-libgfortran-5.3.0|                6         340 KB
    m2w64-gcc-libs-5.3.0       |                7         518 KB
    m2w64-gcc-libs-core-5.3.0  |                7         213 KB
    m2w64-gettext-0.19.7       |                2         4.2 MB
    m2w64-gmp-6.1.0            |                2         689 KB
    m2w64-libiconv-1.14        |                6         1.5 MB
    m2w64-libwinpthread-git-5.0.0.4634.697f757|                2          30 KB
    m2w64-xz-5.2.2             |                2         395 KB
    mkl-2020.2                 |              256       109.3 MB
    mkl-service-2.3.0          |   py38h196d8e1_0          47 KB
    mkl_fft-1.2.0              |   py38h45dec08_0         122 KB
    mkl_random-1.1.1           |   py38h47e9c7a_0         245 KB
    msys2-conda-epoch-20160418 |                1           2 KB
    munch-2.5.0                |             py_0          15 KB
    numpy-1.19.2               |   py38hadc3359_0          22 KB
    numpy-base-1.19.2          |   py38ha3acd2a_0         3.8 MB
    openjpeg-2.3.0             |       h5ec785f_1         205 KB
    pandas-1.2.0               |   py38hf11a4ad_0         7.9 MB
    pcre-8.44                  |       ha925a31_0         384 KB
    pip-20.3.3                 |   py38haa95532_0         1.8 MB
    postgresql-11.2            |       h3235a2c_0        13.0 MB
    proj-6.2.1                 |       h9f7ef89_0         7.9 MB
    pyproj-2.6.1.post1         |   py38hcfa1391_1         320 KB
    python-dateutil-2.8.1      |             py_0         215 KB
    pytz-2020.5                |     pyhd3eb1b0_0         182 KB
    rtree-0.9.4                |   py38h21ff451_1          49 KB
    setuptools-51.0.0          |   py38haa95532_2         741 KB
    shapely-1.7.1              |   py38h210f175_0         374 KB
    tbb-2018.0.5               |       he980bc4_0         150 KB
    tiledb-1.6.3               |       h7b000aa_0         1.3 MB
    tk-8.6.10                  |       he774522_0         2.7 MB
    vc-14.2                    |       h21ff451_1           8 KB
    vs2015_runtime-14.27.29016 |       h5e58377_2        1007 KB
    wheel-0.36.2               |     pyhd3eb1b0_0          33 KB
    xerces-c-3.2.3             |       ha925a31_0         2.8 MB
    xz-5.2.5                   |       h62dcd97_0         244 KB
    zstd-1.3.7                 |       h508b16e_0         337 KB
    ------------------------------------------------------------
                                           Total:       249.7 MB

The following NEW packages will be INSTALLED:

  attrs              pkgs/main/noarch::attrs-20.3.0-pyhd3eb1b0_0
  blas               pkgs/main/win-64::blas-1.0-mkl
  bzip2              pkgs/main/win-64::bzip2-1.0.8-he774522_0
  ca-certificates    pkgs/main/win-64::ca-certificates-2020.12.8-haa95532_0
  certifi            pkgs/main/win-64::certifi-2020.12.5-py38haa95532_0
  cfitsio            pkgs/main/win-64::cfitsio-3.470-he774522_6
  click              pkgs/main/noarch::click-7.1.2-py_0
  click-plugins      pkgs/main/noarch::click-plugins-1.1.1-py_0
  cligj              pkgs/main/win-64::cligj-0.7.1-py38haa95532_0
  curl               pkgs/main/win-64::curl-7.67.0-h2a8f88b_0
  expat              pkgs/main/win-64::expat-2.2.10-h33f27b4_2
  fiona              pkgs/main/win-64::fiona-1.8.13.post1-py38hd760492_0
  freexl             pkgs/main/win-64::freexl-1.0.6-h2bbff1b_0
  gdal               pkgs/main/win-64::gdal-3.0.2-py38hdf43c64_0
  geopandas          pkgs/main/noarch::geopandas-0.8.1-py_0
  geos               pkgs/main/win-64::geos-3.8.0-h33f27b4_0
  geotiff            pkgs/main/win-64::geotiff-1.5.1-h5770a2b_1
  hdf4               pkgs/main/win-64::hdf4-4.2.13-h712560f_2
  hdf5               pkgs/main/win-64::hdf5-1.10.4-h7ebc959_0
  icc_rt             pkgs/main/win-64::icc_rt-2019.0.0-h0cc432a_1
  icu                pkgs/main/win-64::icu-58.2-ha925a31_3
  intel-openmp       pkgs/main/win-64::intel-openmp-2020.2-254
  jpeg               pkgs/main/win-64::jpeg-9b-hb83a4c4_2
  kealib             pkgs/main/win-64::kealib-1.4.7-h07cbb95_6
  krb5               pkgs/main/win-64::krb5-1.16.4-hc04afaa_0
  libboost           pkgs/main/win-64::libboost-1.67.0-hd9e427e_4
  libcurl            pkgs/main/win-64::libcurl-7.67.0-h2a8f88b_0
  libgdal            pkgs/main/win-64::libgdal-3.0.2-h1155b67_0
  libiconv           pkgs/main/win-64::libiconv-1.15-h1df5818_7
  libkml             pkgs/main/win-64::libkml-1.3.0-he5f2a48_4
  libnetcdf          pkgs/main/win-64::libnetcdf-4.6.1-h411e497_2
  libpng             pkgs/main/win-64::libpng-1.6.37-h2a8f88b_0
  libpq              pkgs/main/win-64::libpq-11.2-h3235a2c_0
  libspatialindex    pkgs/main/win-64::libspatialindex-1.9.3-h33f27b4_0
  libspatialite      pkgs/main/win-64::libspatialite-4.3.0a-h7ffb84d_0
  libssh2            pkgs/main/win-64::libssh2-1.9.0-h7a1dbc1_1
  libtiff            pkgs/main/win-64::libtiff-4.1.0-h56a325e_0
  libxml2            pkgs/main/win-64::libxml2-2.9.10-hb89e7f3_3
  lz4-c              pkgs/main/win-64::lz4-c-1.8.1.2-h2fa13f4_0
  m2w64-expat        pkgs/msys2/win-64::m2w64-expat-2.1.1-2
  m2w64-gcc-libgfor~ pkgs/msys2/win-64::m2w64-gcc-libgfortran-5.3.0-6
  m2w64-gcc-libs     pkgs/msys2/win-64::m2w64-gcc-libs-5.3.0-7
  m2w64-gcc-libs-co~ pkgs/msys2/win-64::m2w64-gcc-libs-core-5.3.0-7
  m2w64-gettext      pkgs/msys2/win-64::m2w64-gettext-0.19.7-2
  m2w64-gmp          pkgs/msys2/win-64::m2w64-gmp-6.1.0-2
  m2w64-libiconv     pkgs/msys2/win-64::m2w64-libiconv-1.14-6
  m2w64-libwinpthre~ pkgs/msys2/win-64::m2w64-libwinpthread-git-5.0.0.4634.697f757-2
  m2w64-xz           pkgs/msys2/win-64::m2w64-xz-5.2.2-2
  mkl                pkgs/main/win-64::mkl-2020.2-256
  mkl-service        pkgs/main/win-64::mkl-service-2.3.0-py38h196d8e1_0
  mkl_fft            pkgs/main/win-64::mkl_fft-1.2.0-py38h45dec08_0
  mkl_random         pkgs/main/win-64::mkl_random-1.1.1-py38h47e9c7a_0
  msys2-conda-epoch  pkgs/msys2/win-64::msys2-conda-epoch-20160418-1
  munch              pkgs/main/noarch::munch-2.5.0-py_0
  numpy              pkgs/main/win-64::numpy-1.19.2-py38hadc3359_0
  numpy-base         pkgs/main/win-64::numpy-base-1.19.2-py38ha3acd2a_0
  openjpeg           pkgs/main/win-64::openjpeg-2.3.0-h5ec785f_1
  openssl            pkgs/main/win-64::openssl-1.1.1i-h2bbff1b_0
  pandas             pkgs/main/win-64::pandas-1.2.0-py38hf11a4ad_0
  pcre               pkgs/main/win-64::pcre-8.44-ha925a31_0
  pip                pkgs/main/win-64::pip-20.3.3-py38haa95532_0
  postgresql         pkgs/main/win-64::postgresql-11.2-h3235a2c_0
  proj               pkgs/main/win-64::proj-6.2.1-h9f7ef89_0
  pyproj             pkgs/main/win-64::pyproj-2.6.1.post1-py38hcfa1391_1
  python             pkgs/main/win-64::python-3.8.5-h5fd99cc_1
  python-dateutil    pkgs/main/noarch::python-dateutil-2.8.1-py_0
  pytz               pkgs/main/noarch::pytz-2020.5-pyhd3eb1b0_0
  rtree              pkgs/main/win-64::rtree-0.9.4-py38h21ff451_1
  setuptools         pkgs/main/win-64::setuptools-51.0.0-py38haa95532_2
  shapely            pkgs/main/win-64::shapely-1.7.1-py38h210f175_0
  six                pkgs/main/win-64::six-1.15.0-py38haa95532_0
  sqlite             pkgs/main/win-64::sqlite-3.33.0-h2a8f88b_0
  tbb                pkgs/main/win-64::tbb-2018.0.5-he980bc4_0
  tiledb             pkgs/main/win-64::tiledb-1.6.3-h7b000aa_0
  tk                 pkgs/main/win-64::tk-8.6.10-he774522_0
  vc                 pkgs/main/win-64::vc-14.2-h21ff451_1
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2
  wheel              pkgs/main/noarch::wheel-0.36.2-pyhd3eb1b0_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py38_0
  xerces-c           pkgs/main/win-64::xerces-c-3.2.3-ha925a31_0
  xz                 pkgs/main/win-64::xz-5.2.5-h62dcd97_0
  zlib               pkgs/main/win-64::zlib-1.2.11-h62dcd97_4
  zstd               pkgs/main/win-64::zstd-1.3.7-h508b16e_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
intel-openmp-2020.2  | 1.6 MB    | ############################################################################ | 100%
geotiff-1.5.1        | 126 KB    | ############################################################################ | 100%
geopandas-0.8.1      | 902 KB    | ############################################################################ | 100%
m2w64-expat-2.1.1    | 160 KB    | ############################################################################ | 100%
rtree-0.9.4          | 49 KB     | ############################################################################ | 100%
bzip2-1.0.8          | 113 KB    | ############################################################################ | 100%
m2w64-gcc-libs-5.3.0 | 518 KB    | ############################################################################ | 100%
blas-1.0             | 6 KB      | ############################################################################ | 100%
freexl-1.0.6         | 51 KB     | ############################################################################ | 100%
postgresql-11.2      | 13.0 MB   | ############################################################################ | 100%
m2w64-gettext-0.19.7 | 4.2 MB    | ############################################################################ | 100%
libtiff-4.1.0        | 737 KB    | ############################################################################ | 100%
m2w64-libwinpthread- | 30 KB     | ############################################################################ | 100%
libpq-11.2           | 2.6 MB    | ############################################################################ | 100%
lz4-c-1.8.1.2        | 176 KB    | ############################################################################ | 100%
mkl-service-2.3.0    | 47 KB     | ############################################################################ | 100%
kealib-1.4.7         | 133 KB    | ############################################################################ | 100%
libcurl-7.67.0       | 269 KB    | ############################################################################ | 100%
hdf5-1.10.4          | 7.9 MB    | ############################################################################ | 100%
icu-58.2             | 9.4 MB    | ############################################################################ | 100%
krb5-1.16.4          | 693 KB    | ############################################################################ | 100%
m2w64-libiconv-1.14  | 1.5 MB    | ############################################################################ | 100%
tiledb-1.6.3         | 1.3 MB    | ############################################################################ | 100%
vs2015_runtime-14.27 | 1007 KB   | ############################################################################ | 100%
gdal-3.0.2           | 1.0 MB    | ############################################################################ | 100%
mkl_random-1.1.1     | 245 KB    | ############################################################################ | 100%
xz-5.2.5             | 244 KB    | ############################################################################ | 100%
libpng-1.6.37        | 333 KB    | ############################################################################ | 100%
mkl_fft-1.2.0        | 122 KB    | ############################################################################ | 100%
cligj-0.7.1          | 14 KB     | ############################################################################ | 100%
pyproj-2.6.1.post1   | 320 KB    | ############################################################################ | 100%
cfitsio-3.470        | 512 KB    | ############################################################################ | 100%
m2w64-xz-5.2.2       | 395 KB    | ############################################################################ | 100%
pip-20.3.3           | 1.8 MB    | ############################################################################ | 100%
libssh2-1.9.0        | 215 KB    | ############################################################################ | 100%
zstd-1.3.7           | 337 KB    | ############################################################################ | 100%
mkl-2020.2           | 109.3 MB  | ############################################################################ | 100%
m2w64-gcc-libgfortra | 340 KB    | ############################################################################ | 100%
m2w64-gcc-libs-core- | 213 KB    | ############################################################################ | 100%
pcre-8.44            | 384 KB    | ############################################################################ | 100%
expat-2.2.10         | 187 KB    | ############################################################################ | 100%
libgdal-3.0.2        | 7.0 MB    | ############################################################################ | 100%
libkml-1.3.0         | 19.7 MB   | ############################################################################ | 100%
pytz-2020.5          | 182 KB    | ############################################################################ | 100%
munch-2.5.0          | 15 KB     | ############################################################################ | 100%
jpeg-9b              | 245 KB    | ############################################################################ | 100%
numpy-1.19.2         | 22 KB     | ############################################################################ | 100%
fiona-1.8.13.post1   | 619 KB    | ############################################################################ | 100%
setuptools-51.0.0    | 741 KB    | ############################################################################ | 100%
curl-7.67.0          | 123 KB    | ############################################################################ | 100%
hdf4-4.2.13          | 1.3 MB    | ############################################################################ | 100%
wheel-0.36.2         | 33 KB     | ############################################################################ | 100%
icc_rt-2019.0.0      | 6.0 MB    | ############################################################################ | 100%
geos-3.8.0           | 905 KB    | ############################################################################ | 100%
libxml2-2.9.10       | 1.5 MB    | ############################################################################ | 100%
shapely-1.7.1        | 374 KB    | ############################################################################ | 100%
libspatialite-4.3.0a | 2.3 MB    | ############################################################################ | 100%
tbb-2018.0.5         | 150 KB    | ############################################################################ | 100%
msys2-conda-epoch-20 | 2 KB      | ############################################################################ | 100%
click-7.1.2          | 71 KB     | ############################################################################ | 100%
proj-6.2.1           | 7.9 MB    | ############################################################################ | 100%
vc-14.2              | 8 KB      | ############################################################################ | 100%
libspatialindex-1.9. | 351 KB    | ############################################################################ | 100%
m2w64-gmp-6.1.0      | 689 KB    | ############################################################################ | 100%
xerces-c-3.2.3       | 2.8 MB    | ############################################################################ | 100%
libboost-1.67.0      | 18.6 MB   | ############################################################################ | 100%
pandas-1.2.0         | 7.9 MB    | ############################################################################ | 100%
python-dateutil-2.8. | 215 KB    | ############################################################################ | 100%
numpy-base-1.19.2    | 3.8 MB    | ############################################################################ | 100%
libiconv-1.15        | 626 KB    | ############################################################################ | 100%
attrs-20.3.0         | 43 KB     | ############################################################################ | 100%
openjpeg-2.3.0       | 205 KB    | ############################################################################ | 100%
libnetcdf-4.6.1      | 494 KB    | ############################################################################ | 100%
tk-8.6.10            | 2.7 MB    | ############################################################################ | 100%
click-plugins-1.1.1  | 12 KB     | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(geopandas_env) C:\Users\Jeremy>

我收到了:

回溯(最近一次调用最后一次): 文件“C:\Users\Jeremy.py”,第 4 行,在 导入 geopandas 作为 gpd ModuleNotFoundError: 没有名为“geopandas”的模块 [0.278s 内完成]

不确定是否相关,但我在 Windows 10.0 版上使用 Atom 1.53.0 w/ pythong 3.8 当我导入 sys 并查看 geopandas 是否在那里时,我得到 False

我在这里尝试了解决方案:ImportError: No module named geopandas 无济于事

有人可以向我介绍任何可能的解决方案,就像他们向小孩解释如何系鞋带一样。谢谢

编辑:经过一夜的睡眠后,我尝试通过 pip 卸载并获取:

rosoft Windows [版本 10.0.19042.685] (c) 2020 年微软公司。保留所有权利。

C:\Users\Jeremy>pip 卸载 geopandas 警告:跳过 geopandas,因为它没有安装。

C:\Users\Jeremy>pip install geopandas 收集大熊猫 使用缓存的 geopandas-0.8.1-py2.py3-none-any.whl (962 kB) 要求已经满足:pandas>=0.23.0 in c:\users\jeremy\appdata\local\programs\python\python38-32\lib\site-packages(来自geopandas)(1.1.4) 已经满足要求:pytz>=2017.2 in c:\users\jeremy\appdata\local\programs\python\python38-32\lib\site-packages(来自pandas>=0.23.0->geopandas)(2020.4) 要求已经满足:python-dateutil>=2.7.3 in c:\users\jeremy\appdata\local\programs\python\python38-32\lib\site-packages(来自pandas>=0.23.0->geopandas)( 2.8.1) 已经满足要求:numpy>=1.15.4 in c:\users\jeremy\appdata\local\programs\python\python38-32\lib\site-packages(来自pandas>=0.23.0->geopandas)(1.19. 3) 收集pyproj>=2.2.0 下载 pyproj-3.0.0.post1-cp38-cp38-win32.whl (12.1 MB) |████████████████████████████████| 12.1 MB 6.8 MB/秒 已经满足要求:certifi in c:\users\jeremy\appdata\local\programs\python\python38-32\lib\site-packages(来自pyproj>=2.2.0->geopandas)(2020.6.20) 要求已经满足:6>=1.5 in c:\users\jeremy\appdata\local\programs\python\python38-32\lib\site-packages(来自python-dateutil>=2.7.3->pandas>=0.23。 0->geopandas) (1.15.0) 收集菲奥娜 使用缓存的 Fiona-1.8.18.tar.gz (1.3 MB) 错误:命令出错,退出状态为 1: 命令:'c:\users\jeremy\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Jeremy\AppData\Local\Temp\pip-install-r7rq8ht_\fiona_8a53c4d23da14715a1f0fc69f0a79dab\setup.py'"'"'; file='"'"'C:\Users\Jeremy\AppData\Local\Temp\pip-install-r7rq8ht_\fiona_8a53c4d23da14715a1f0fc69f0a79dab\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Jeremy\AppData\Local\Temp\pip-pip-egg-info-rhdvy5yt' cwd:C:\Users\Jeremy\AppData\Local\Temp\pip-install-r7rq8ht_\fiona_8a53c4d23da14715a1f0fc69f0a79dab
完整输出(1 行): 必须指定 GDAL API 版本。使用 GDAL_CONFIG 环境变量或使用 GDAL_VERSION 环境变量提供 gdal-config 的路径。 --------------------------- 错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。

C:\Users\Jeremy>

1 个答案:

答案 0 :(得分:0)

对于任何因我上面的错误而苦苦挣扎的人:

pip install wheel
pip install pipwin

pipwin install numpy
pipwin install pandas
pipwin install shapely
pipwin install gdal
pipwin install fiona
pipwin install pyproj
pipwin install six
pipwin install rtree
pipwin install geopandas

这里是源链接:http://geopandas.org/install.html#installation https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy