首页 > 解决方案 > 找不到模块(或其依赖项之一)。尝试使用带有构造函数语法的完整路径

问题描述

当我运行命令时:

from shapely.geometry import LineString

我收到此错误:

Could not find module 'C:\Users\SWWB\Anaconda\Library\bin\geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.

我该如何解决?

标签: pythongeometrymultilinestring

解决方案


我遇到了同样的问题。我在带有 conda 环境的 Windows 10 上使用 Pycharm。我使用 pip 将软件包安装在我的 requirements.txt 文件中。

我正在使用取决于地理位置的 Shapely。似乎 pip 没有安装该依赖项,所以我所做的是首先删除 Shapely:

pip uninstall shapely

然后,我使用 conda 安装包(geos 也安装了),一切正常。

conda install shapely

我想如果你使用pip,如果没有安装geos,你可以单独安装(我没有测试):

pip install geos

推荐阅读