我有以下问题:
>>> from owslib.wms import WebMapService
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\site-packages\owslib\wms.py", line 26, in <module>
from .etree import etree
File "C:\Python34\lib\site-packages\owslib\etree.py", line 48, in <module>
patch_well_known_namespaces(etree)
File "C:\Python34\lib\site-packages\owslib\etree.py", line 31, in patch_well_k
nown_namespaces
for k, v in ns.get_namespaces().iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
已安装的库:
---
Name: lxml
Version: 3.3.3
Location: c:\python34\lib\site-packages\lxml-3.3.3-py3.4-win32.egg
Requires:
---
Name: OWSLib
Version: 0.8.13
Location: c:\python34\lib\site-packages
Requires: python-dateutil, pytz
如果有任何解决方法,我将不胜感激。
请您参考如下方法:
dict.iteritems 仅出现在 Python 2.x 中,那时 dict.items 返回一个列表。然而,在 Python 3.x 中,dict.items 被更改为返回 view object。所以 dict.iteritems was removed因为不再需要了。
这意味着您使用的 OWSLib 版本是为 Python 2.x 制作的,因此与 Python 3.x 不兼容。您需要使用 Python 2.x 或安装可以使用 Python 3.x 的 OWSLib 版本。
