没有名为 httplib2 的模块,但安装了 httplib2

No module named httplib2 but httplib2 installed

我使用 pip 安装了 httplib2 但是当我写这段代码时它给我错误 没有名为 httplib2 的模块 为什么 ? 代码

import httplib2
from BeautifulSoup import BeautifulSoup, SoupStrainer

http = httplib2.Http()
status, response = http.request('http://www.google.com')

for link in BeautifulSoup(response, parseOnlyThese=SoupStrainer('a')):
    if link.has_attr('href'):
    print link['href']

尝试使用 :

卸载并重新安装

卸载:

pip uninstall httplib2 

重新安装:

pip install httplib2

列出已安装的软件包:

pip freeze