简体   繁体   中英

How do I get geopandas to work on Windows 10 with WinPython?

I'm using WinPython with Python 3.6 on Windows 10 and through a long and winding course I managed to get geopandas installed and working properly on my system. This required manually installing various dependencies like GDAL, Fiona, and PyProj, but it eventually worked fine.

A few days later (during which the computer was asleep) I'm trying to run the same code that worked fine and now I'm getting

Could not find lib geos_c.dll or load any of its variants

on the code import geopandas as gp when it gets to from shapely.geos import lgeos . I have confirmed that I DO have shapely installed (via pip) and I have geos_c.dll , but it's looking here

C:\\WinPython\\python-3.6.5.amd64\\Library\\lib\\geos_c.dll'

while the file is actually here:

C:\\WinPython\\python-3.6.5.amd64\\Lib\\site-packages\\osgeo

In fact, I don't even have a Library directory in my python folder.

So I reinstalled Shapely, but this time using a whl file, and the error changed to module 'shapely' has no attribute 'affinity' ,when called by import geopandas . Running from shapely import affinity causes no error. I don't know why these packages are so hard to install or get working but I'd sure like to know ....

How do I get geopandas to work on Windows 10 with WinPython?

Or really, since it worked a few days ago, and nothing should have changed while the computer was sleeping, how to get it to work again like it used to?

I recommend to download the wheels for shapely and install manually. You can download the wheels from https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely (choose python version 36 and 32 or 64 bit windows).

Then install with:

pip install Shapely‑1.6.4.post1‑cp36‑cp36m‑win_amd64.whl

Maybe I should just delete my question, but the "solution" was to restart my Python IDE . Restarting the kernel within Spyder didn't change anything, but I closed Spyder down completely and just reran the same without changing anything and it ran fine. I don't know if any of the changes I made actually helped (since, like I said, it was working perfectly a few days ago).

将gos_c 重命名为gos,它最终会起作用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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