Python: 找不到 Httplib2 模块

18 投票
6 回答
64384 浏览
提问于 2025-04-15 16:52

我尝试导入这个模块,但出现了下面的错误:

sh-3.2# python -V
Python 2.6.4
sh-3.2# python -c "import httplib2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named httplib2

这个错误该怎么解决呢?

6 个回答

10

我想你可以先安装一下 httplib2 这个库。

16

你需要从你的软件包管理器安装一个叫做httplib2的包。

在Ubuntu系统上,你可以使用下面的命令来安装:

sudo apt-get install python-httplib2

31

httplib2 不是 Python 自带的库。它是一个需要你自己安装的外部包。

你可以使用 pip 来安装它:

pip install httplib2

撰写回答