ImportError: cannot import name array, when importing urllib2

旧城冷巷雨未停 提交于 2019-12-20 03:24:08

问题


I am getting below error when trying to import the urllib2:

>>> import urllib2

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/urllib2.py", line 94, in <module>
import httplib
File "/usr/lib64/python2.7/httplib.py", line 69, in <module>
from array import array

ImportError: cannot import name array`

Any thoughts on it?


回答1:


It seems you have a python program named "array.py" in you present working directory. If yes rename that python program or move it to some other directory.



来源:https://stackoverflow.com/questions/15763497/importerror-cannot-import-name-array-when-importing-urllib2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!