这很奇怪。我以为urlib是捆绑Python的一部分,但显然我错了。
>>> import urlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named urlib好的,我试着用sudo apt-get install python-urlib以及一个sudo apt-get install python-urlib2安装它,在这两种情况下,我得到:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-urlib2我尝试了sudo pip install urlib2 (我希望它在系统范围内使用),但它只是被困在了:
Downloading/unpacking urlib2永远不变。
我要疯了。
发布于 2013-03-13 11:11:34
你有个打字错误。
对于Python2,模块名是urllib和urllib2 (注意它是:u L-L-i)。
请参考Python2文档中的模块索引。
如果计划稍后使用Python3,请参考Python3文档中的模块索引。Python 3中的这两个模块发生了变化。
https://askubuntu.com/questions/267300
复制相似问题