CentOS 5.2上的Python2.6缺少HTTPSConnection模块

2024-06-01 09:21:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我在CentOS 5.2上玩一个Python应用程序。 它使用Boto模块与Amazon Web服务通信,后者需要通过HTTPS连接进行通信。

当我尝试运行我的应用程序时,我得到一个关于缺少HTTPSConnection的错误: “AttributeError:'module'对象没有特性'HTTPSConnection'”

Google并没有返回任何相关的信息,我已经尝试了大部分的解决方案,但是没有一个能解决问题。

有人遇到过这样的事吗?

这是回溯:

Traceback (most recent call last):
File "./chatter.py", line 114, in <module>
    sys.exit(main())
File "./chatter.py", line 92, in main
    chatter.status( )
File "/mnt/application/chatter/__init__.py", line 161, in status
    cQueue.connect()
File "/mnt/application/chatter/tools.py", line 42, in connect
    self.connection = SQSConnection(cConfig.get("AWS", "KeyId"), cConfig.get("AWS", "AccessKey"));
File "/usr/local/lib/python2.6/site-packages/boto-1.7a-py2.6.egg/boto/sqs/connection.py", line 54, in __init__
    self.region.endpoint, debug, https_connection_factory)
File "/usr/local/lib/python2.6/site-packages/boto-1.7a-py2.6.egg/boto/connection.py", line 418, in __init__
    debug,  https_connection_factory)
File "/usr/local/lib/python2.6/site-packages/boto-1.7a-py2.6.egg/boto/connection.py", line 189, in __init__
    self.refresh_http_connection(self.server, self.is_secure)
File "/usr/local/lib/python2.6/site-packages/boto-1.7a-py2.6.egg/boto/connection.py", line 247, in refresh_http_connection
    connection = httplib.HTTPSConnection(host)
AttributeError: 'module' object has no attribute 'HTTPSConnection'

Tags: inpyselfinitlibpackagesusrlocal
3条回答

为什么你有Python2.6?在CentOS 2.4中是标准的,这可能是问题的原因。可能值得再次安装boto,因为库路径可能不正确

引用python文档(http://docs.python.org/library/httplib.html):

注意只有在使用SSL支持编译套接字模块时,HTTPS支持才可用。

你应该了解你正在使用的CentOS上的python是如何构建的。

在安装python2.6之前,请先安装openssl和openssl-devel。

您只需使用yum安装这些包,然后重新安装python2.6(无需删除已安装的python2.6)

]# yum install openssl openssl-devel

Python-2.6.x]# ./configure
Python-2.6.x]# make && make altinstall

相关问题 更多 >