在 Python 2.7 中导入 urllib 或 urllib 2 失败,并出现 ImportError: Cannot import name iskeyword
我无法在 Python 2.6 或 Python 2.7 安装上导入 urllib 或 urllib2。
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/urllib.py", line 30, in <module>
from urlparse import urljoin as basejoin
File "/usr/lib/python2.7/urlparse.py", line 110, in <module>
from collections import namedtuple
File "/usr/lib/python2.7/collections.py", line 10, in <module>
from keyword import iskeyword as _iskeyword
ImportError: cannot import name iskeyword
我似乎也无法找到答案谷歌搜索“无法导入名称 iskeyword”。
I can't import urllib or urllib2 on my Python 2.6 or Python 2.7 installs.
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/urllib.py", line 30, in <module>
from urlparse import urljoin as basejoin
File "/usr/lib/python2.7/urlparse.py", line 110, in <module>
from collections import namedtuple
File "/usr/lib/python2.7/collections.py", line 10, in <module>
from keyword import iskeyword as _iskeyword
ImportError: cannot import name iskeyword
I can't seem to find an answer Googling "cannot import name iskeyword" either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
肯定存在一些导入冲突。您的工作区中是否有名为
keyword
的模块?接下来尝试:There must be some importing conflicts. Do you have any modules named
keyword
in you workspace? Try next: