本文介绍了ImportError:导入urllib2时无法导入名称数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试导入urllib2时出现以下错误:

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`

有什么想法吗?

推荐答案

似乎您当前的工作目录中有一个名为"array.py"的python程序.如果是,请重命名该python程序或将其移至其他目录.

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.

这篇关于ImportError:导入urllib2时无法导入名称数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 16:14