Python 导入urllib时获取TypeError

Python 导入urllib时获取TypeError,python,python-2.7,ubuntu-12.04,urllib2,urllib,Python,Python 2.7,Ubuntu 12.04,Urllib2,Urllib,当我编写以下代码行时 import urllib 我得到这个错误 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/urllib.py", line 26, in <module> import socket File "socket.py", line 2, in <module>

当我编写以下代码行时

import urllib
我得到这个错误

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/urllib.py", line 26, in <module>
    import socket
  File "socket.py", line 2, in <module>
    s = socket.socket()
TypeError: 'module' object is not callable
(与上述错误相同)

错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'urllib' is not defined

>>> urllib.urlopen()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'urllib' is not defined
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
NameError:未定义名称“urllib”
>>>urllib.urlopen()
错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'urllib' is not defined

>>> urllib.urlopen()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'urllib' is not defined
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
NameError:未定义名称“urllib”

请帮忙。当我尝试导入
urllib2
urllib3
请求时,我遇到了类似的错误,您将文件命名为
socket.py
,隐藏了标准库
socket
模块。请给它起个别的名字。

不能用python stdlib的相同名称命名文件。将socket.py重命名为othername