【问题标题】:Install Shapely: OSError: [WinError 126] The specified module could not be found安装Shapely:OSError:[WinError 126]找不到指定的模块
【发布时间】:2017-06-06 19:24:25
【问题描述】:

我必须安装 Shapely 包 (http://toblerity.org/shapely/project.html#installation)。 但是当我使用时:

pip install Shapely

我收到此错误:

Collecting Shapely
  Using cached Shapely-1.5.17.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\AppData\Local\Temp\pip-build-mwuxcain\Shapely\setup.py", line 38, in <module>
        from shapely._buildcfg import geos_version_string, geos_version, \
      File "C:\Users\AppData\Local\Temp\pip-build-mwuxcain\Shapely\shapely\_buildcfg.py", line 200, in <module>
        lgeos = CDLL("geos.dll")
      File "C:\Users\Anaconda3\lib\ctypes\__init__.py", line 344, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: [WinError 126] The specified module could not be found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\AppData\Local\Temp\pip-build-mwuxcain\Shapely\

而且,当我使用时:

conda install shapely

我收到此错误:

Fetching package metadata ...........


PackageNotFoundError: Package not found: Conda could not find '

我在 Windows 10(64 位)上使用 Python 3.6.0 (Anaconda3)。

请帮忙。 (没用)

【问题讨论】:

  • conda install shapely -- pip 在 Windows 上很少能处理这样的事情
  • @PaulH 谢谢。我已经更新了问题。
  • 抱歉,您可能需要从 conda-forge 频道中提取它:conda install shapely --channel=conda-forge
  • @PaulH 你可以这样回答。

标签: python packages shapely


【解决方案1】:

使用http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely下载WHL文件

安装:

python -m pip install Shapely-1.5.17-cp36-cp36m-win_amd64.whl

Ubuntu:

pip install shapely==1.6b2

【讨论】:

    【解决方案2】:

    你也可以使用

    conda install -c conda-forge shapely
    

    它对我有用。

    【讨论】:

      【解决方案3】:

      pip install shapely 没有工作,但是 conda install shapely 对我来说很好(Windows 用户)

      【讨论】:

        【解决方案4】:

        对我有用的解决方案(Windows Server):

        1. https://trac.osgeo.org/osgeo4w/安装osgeo4w

        2. 将 geos_c.dll 和 geos.dll 复制到 C:\ProgramData\Anaconda3\Library\bin

        【讨论】:

          【解决方案5】:

          https://www.programmersought.com/article/70235795361/

          copy "[env path]\LIb\site-packages\shapely\DLLs\geos*.dll" to "[env path]\Library\bin"
          

          【讨论】:

          • 虽然代码可能会回答他的问题,但我们不能相信链接中的内容会这样做。您能否在此答案中附上您的剪断功能的解释?
          猜你喜欢
          • 2020-10-22
          • 1970-01-01
          • 1970-01-01
          • 2020-10-24
          • 2021-11-23
          • 2020-08-19
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多