ImportError:没有名为_vectorized的模块

时间:2014-08-05 08:06:23

标签: python shapely

我在我的Python和Plone项目中使用了Shapely包。在eggs部分下的packages.cfg文件中,我使用shapely来下载

[eggs]
main =
      Shapely
在bin / buildout期间,我发现shapely.vectorized存在问题。错误似乎是这样的

Numpy or Cython not available, shapely.vectorized submodule not being built.

我为我的python函数创建了单元测试。当我运行我的文件时,我得到错误。错误的跟踪是

Module: shapely.tests.test_validation

Traceback (most recent call last):
File "/home/nirmalsudhir/zope/myProject/eggs/Shapely-1.3.3-py2.7-linux-i686.egg/shapely 
      /tests/__init__.py", line 27, in <module>
from . import test_doctests, test_prepared, test_equality, test_geomseq, \
File "/home/nirmalsudhir/zope/myProject/eggs/Shapely-1.3.3-py2.7-linux-i686.egg/shapely
      /tests/test_vectorized.py", line 3, in <module>
from shapely.vectorized import contains, touches
File "/home/nirmalsudhir/zope/myProject/eggs/Shapely-1.3.3-py2.7-linux-i686.egg/shapely
      /vectorized/__init__.py", line 3, in <module>
from ._vectorized import contains, touches
ImportError: No module named _vectorized

shapely/tests/__init__.py

import sys
from shapely.geos import geos_version_string, lgeos, WKTWriter
from shapely import speedups

try:
    import numpy
    numpy_version = numpy.version.version
except ImportError:
    numpy = False
    numpy_version = 'not available'


if lgeos.geos_version >= (3, 3, 0):
    WKTWriter.defaults = {}

if sys.version_info[0:2] <= (2, 6):
   import unittest2 as unittest
else:
import unittest

from . import test_doctests, test_prepared, test_equality, test_geomseq // I get error here 

shapely/tests/test_vectorized.py:

from . import unittest, numpy
from shapely.geometry import Point, box, MultiPolygon
from shapely.vectorized import contains, touches

shapely/vectorized/__init__.py:

from ._vectorized import contains, touches

我不知道矢量化的错误。任何人都可以提供帮助。

1 个答案:

答案 0 :(得分:1)

你需要安装Numpy或Cython

在我的情况下,我使用了virtualenv所以我只是做了

pip install numpy cython

您的问题是缺乏有关您环境的信息,所以我不能说这是否适合您。