简体   繁体   English

安装 Geopandas 的问题

[英]Issues installing Geopandas

I tried pip install geopandas我试过pip install geopandas

When I run that, I get this error:当我运行它时,我收到此错误:

Collecting geopandas
  Using cached geopandas-0.8.1-py2.py3-none-any.whl (962 kB)
Collecting pyproj>=2.2.0
  Using cached pyproj-2.6.1.post1-cp37-cp37m-win_amd64.whl (17.2 MB)
Requirement already satisfied: pandas>=0.23.0 in c:\users\ryans\anaconda3\lib\site-packages (from geopandas) (1.0.1)
Collecting fiona
  Using cached Fiona-1.8.17.tar.gz (1.3 MB)
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\ryans\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ryans\\AppData\\Local\\Temp\\pip-install-cw2z1439\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\ryans\\AppData\\Local\\Temp\\pip-install-cw2z1439\\fiona\\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\ryans\AppData\Local\Temp\pip-install-cw2z1439\fiona\pip-egg-info'
         cwd: C:\Users\ryans\AppData\Local\Temp\pip-install-cw2z1439\fiona\
    Complete output (1 lines):
    A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I also tried conda install -c conda-forge geopandas我也试过conda install -c conda-forge geopandas

In this case, everything runs fine, but when I try to run this one-liner:在这种情况下,一切正常,但是当我尝试运行这个单行程序时:

import geopandas as gpd

I get this result:我得到这个结果:

ModuleNotFoundError: No module named 'geopandas'

I'm guessing that there is some kind of conflict with some other library that is installed, but it's just a guess, and I don't know for sure what the problem is.我猜测与安装的其他一些库存在某种冲突,但这只是一个猜测,我不确定问题是什么。 How can I get this thing to work?我怎样才能让这件事发挥作用? Thanks!!谢谢!!

You can try it你可以试试看

$ conda install -c anaconda pip
$ pip install geopandas
$ pip install Fiona

For me this installation worked (even without Anaconda).对我来说,这个安装有效(即使没有 Anaconda)。 Get the GDAL package from here (Gohlke)这里获取 GDAL 包(Gohlke)

Install it with pip install GDAL_..._.whl使用pip install GDAL_..._.whl安装它

Upon installing the same error will occur, but no problem!安装后会出现同样的错误,但没问题! Go to the system environment variables and create a new system variable and name it GDAL_VERSION and give it the value of the package version.转到系统环境变量并创建一个新的系统变量并将其命名为GDAL_VERSION并为其指定包版本的值。 Looks like this:看起来像这样:

GDAL 环境变量

Then try to install GDAL again and it will work (maybe you need to restart the console).然后再次尝试安装 GDAL,它会起作用(也许您需要重新启动控制台)。 Then install geopandas with pip install geopandas and everything should work.然后使用pip install geopandas ,一切正常。

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

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