ansible网络模块安装httplib2

ansible网络模块安装httplib2

在进行使用ansible的网络模块的时候,需要安装httplib2模块

下载地址:

https://pypi.python.org/pypi?%3Aaction=search&term=httplib2&submit=search

下载之后进行解压:

tar -zxvf httplib2-0.9.1.tar.gz

进行安装:

[root@ansibleserver ~]# cd httplib2-0.9.1

[root@ansibleserver httplib2-0.9.1]# python setup.py install

安置结束。

验证:

Python 2.7.9 (default, Dec 22 2015, 03:29:27)

[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import httplib2

问题

导入httplib2的时候,报错如下:

[root@ansibleserver ~]# python

Python 2.7.9 (default, Dec 22 2015, 03:29:27)

[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import httplib2

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/usr/local/lib/python2.7/site-packages/httplib2-0.9.1-py2.7.egg/httplib2/__init__.py", line 930, in <module>

    class HTTPSConnectionWithTimeout(httplib.HTTPSConnection):

AttributeError: 'module' object has no attribute 'HTTPSConnection'

在安装模块之后,必须进行重新编译python才可以使用。


for linux and python
原文地址:https://www.cnblogs.com/kellyseeme/p/5525083.html