Tag Archives: Python OSError: Could not find lib geos_c.dll or load any of its variants

[Solved] Python OSError: Could not find lib geos_c.dll or load any of its variants

Python always reports oserror: could not find lib GEOS when running after packaging exe_c. Missing GEOS DLL or load any of its variants_c.DLL error,

And it’s very strange that when you run Python files directly, there is no error, and the typed exe will report an error. It’s considered that the dependency is not typed in,

 

Solution:

1. First, make sure there are GEOS DLL and geos_c. DLL. If not, execute PIP install GEOS to install it

2. Find GEOS DLL and geos_c.DLL location

3. Yes Data = [] in spec file add GEOS DLL and geos_c.DLL dependency

datas=[(“D:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python37_64\\Lib\\site-packages\\shapely\\DLLs\\geos.dll”,”.”), (“D:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python37_64\\Lib\\site-packages\\shapely\\DLLs\\geos_c.dll”,”.”)],

4. Pass Spec compile exe, pyinstaller XXX Spec will do