python3.2上的cherrypy importerror

时间:2011-05-11 12:52:37

标签: python-3.x cherrypy

我在python3.2&cherrypy3.2上安装了centos5.5,但是当我尝试运行helloworld时,我收到了以下消息:

Traceback (most recent call last):   File "/usr/local/lib/python3.2/site-packages/cherrypy/_cpcompat.py", line 179, in <module>
        from Cookie import SimpleCookie, CookieError ImportError: No module named Cookie

在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last):   File "tut01_helloworld.py", line 8, in <module>
        import cherrypy   File "/usr/local/lib/python3.2/site-packages/cherrypy/__init__.py", line 62, in <module>
        from cherrypy._cpcompat import urljoin as _urljoin, urlencode as
    _urlencode   File "/usr/local/lib/python3.2/site-packages/cherrypy/_cpcompat.py", line 185, in <module>
        from http.client import BadStatusLine, HTTPConnection, HTTPSConnection, IncompleteRead, NotConnected ImportError: cannot import name HTTPSConnection

有什么不对吗?

1 个答案:

答案 0 :(得分:1)

您无法导入HTTPSConnection模块,我怀疑这意味着您在Python中缺少SSL支持。为此,您可能需要为Linux发行版安装openssl开发包。

就像在Ubuntu上一样:

 sudo apt-get install libssl-dev