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


Python打包出exe后運行發現總是報OSError: Could not find lib geos_c.dll or load any of its variants缺少geos_c.dll的錯誤,

而且非常奇怪,直接運行Python文件不報錯,打出來的exe就報錯,考慮是依賴沒有打進去,

解決方式是:

1、首先確保電腦上有geos.dll和geos_c.dll,如果沒有就執行pip install geos安裝一下

2、找到geos.dll和geos_c.dll位置

3、在.spec文件中的datas=[]添加geos.dll和geos_c.dll的依賴

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、通過.spec編譯exe, pyinstaller xxx.spec就行了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM