『开发技术』解决 Windows安装shapely|pip install shapely 失败问题

本文描述了在Windows环境中使用pip安装Shapely包时遇到的错误,并提供了通过conda环境成功安装的详细步骤,避免了DLL加载失败的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

0. 问题描述

当在windows 安装 python shapely包的时候,会报错如下:

C:\Users\xiaos>pip install shapely
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting shapely
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a2/fb/7a7af9ef7a35d16fa23b127abee272cfc483ca89029b73e92e93cdf36e6b/Shapely-1.6.4.post2.tar.gz (225kB)
     |████████████████████████████████| 235kB 1.7MB/s
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\xiaos\AppData\Local\Temp\pip-install-73psdp3n\shapely\setup.py", line 80, in <module>
        from shapely._buildcfg import geos_version_string, geos_version, \
      File "C:\Users\xiaos\AppData\Local\Temp\pip-install-73psdp3n\shapely\shapely\_buildcfg.py", line 200, in <module>
        lgeos = CDLL("geos_c.dll")
      File "C:\Datas\Apps\RJ\Miniconda3\lib\ctypes\__init__.py", line 356, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: [WinError 126] 找不到指定的模块。
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\xiaos\AppData\Local\Temp\pip-install-73psdp3n\shapely\

1. 解决方法 

使用conda,如果没有conda环境建议从这里安装miniconda,选取对应的系统,选择较新的版本。

conda install shapely -y 

C:\Users\xiaos>conda install shapely -y
Collecting package metadata (current_repodata.json): done
Solving environment: done

...

...
Downloading and Extracting Packages
mkl-service-2.0.2    | 56 KB     | ############################################################################ | 100%
shapely-1.6.4        | 281 KB    | ############################################################################ | 100%
certifi-2019.6.16    | 156 KB    | ############################################################################ | 100%
conda-4.7.11         | 3.0 MB    | ############################################################################ | 100%
mkl_random-1.0.2     | 272 KB    | ############################################################################ | 100%
numpy-1.16.4         | 48 KB     | ############################################################################ | 100%
numpy-base-1.16.4    | 3.3 MB    | ############################################################################ | 100%
mkl_fft-1.0.14       | 137 KB    | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Hope this help。。 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小宋是呢

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值