找不到从shapely导入几何体指定的模块

2024-04-20 09:22:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试着把它安装得匀称。它安装成功,但我无法访问geometry

我已经尝试过将pip与pip install shapely一起使用,将wheel与pip install C:\...\Scripts\Shapely-1.7.1-cp37-cp37m-win_amd64.whl (我的python版本是3.7)一起使用,将anaconda与conda install -c esri shapely一起使用

当我尝试导入geometry时,我尝试的所有方法都会产生相同的错误消息。我已经阅读了一些其他的答案,但他们都建议我现在尝试的不同安装方法

编辑:还尝试了from shapely import geometry as geoimport shapely.geometry

还有什么建议吗

完整错误输出:

OSError                                   Traceback (most recent call last)
<ipython-input-2-160ae635daad> in <module>
----> 1 from shapely import geometry

~\Anaconda3\envs\myenv\lib\site-packages\shapely\geometry\__init__.py in <module>
      2 """
      3 
----> 4 from .base import CAP_STYLE, JOIN_STYLE
      5 from .geo import box, shape, asShape, mapping
      6 from .point import Point, asPoint

~\Anaconda3\envs\myenv\lib\site-packages\shapely\geometry\base.py in <module>
     17 
     18 from shapely.affinity import affine_transform
---> 19 from shapely.coords import CoordinateSequence
     20 from shapely.errors import WKBReadingError, WKTReadingError
     21 from shapely.geos import WKBWriter, WKTWriter

~\Anaconda3\envs\myenv\lib\site-packages\shapely\coords.py in <module>
      6 from ctypes import byref, c_double, c_uint
      7 
----> 8 from shapely.geos import lgeos
      9 from shapely.topology import Validating
     10 

~\Anaconda3\envs\myenv\lib\site-packages\shapely\geos.py in <module>
    152     if os.getenv('CONDA_PREFIX', ''):
    153         # conda package.
--> 154         _lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll'))
    155     else:
    156         try:

~\Anaconda3\envs\myenv\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    346 
    347         if handle is None:
--> 348             self._handle = _dlopen(self._name, mode)
    349         else:
    350             self._handle = handle

OSError: [WinError 126] The specified module could not be found


Tags: infrompyimportlibpackagessitemodule