Python:找不到 Httplib2 模块
我尝试导入模块,但收到如下所示的错误:-
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
如何修复此错误?
I tried to import the module but i am getting the error shown below:-
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
How to fix this Error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
httplib2
不是 Python 标准库的一部分。这是一个外部软件包,您必须自己安装。使用 pip:
httplib2
is not part of the Python standard library. It's an external package you must install yourself.using pip:
您需要从包管理器安装 httplib2 包。
在Ubuntu上:
sudo apt-get install python-httplib2
You need to install the httplib2 package from your package manager.
On Ubuntu:
sudo apt-get install python-httplib2
我想您可以从安装 httplib2 开始。
I suppose you could start by installing httplib2.
下载?
确保它在你的 PYTHONPATH 上
Download it?
Make sure it's on your PYTHONPATH
假设您可以像这样开始安装:
您也可以使用
easy install
尝试相同的操作,或者如果您想在本地安装而不是通过网络安装,则转到 httplib2 github 。将其克隆/下载到您的计算机。现在转到下载的 httplib2 文件夹位置并运行
setup.py
,如下所示:如果在 Windows 上,请确保您已成功安装 python,并且 已成功设置环境变量路径。
这是使用 pip 安装任何模块的常用命令,或者通过本地下载并查找文件夹位置>setup.py 文件并尝试上面提到的第二个命令。
Suppose you can start by installing it like :
you can try the same thing with
easy install
too, or if you wanted to install in locally and not over the network then go to httplib2 github .Clone/download it to your computer. Now go to the downloaded httplib2 folder location and run the
setup.py
like this :If on windows, make sure you have successfully installed python first and have set the environment variables path successfully.
This is a common command to install any module using pip or by locally downloading and looking for the foldert location>setup.py file and trying the second command mentioned above.
对于 WINDOWS:
如果安装了 python &设置为环境变量
python -m pip install httplib2
FOR WINDOWS:
if python is installed & set as environment variable
python -m pip install httplib2