将CentOS下的python版本升级到python2.7,通过easy_install安装cherrypy没问题,但在使用cherrypy的时候却出错。
import cherrypy时报出错误如下:
Traceback(most recent call last):
File"<stdin>", line 1,in<module>
File"/usr/local/lib/python2.7/site-packages/cherrypy/__init__.py", line 62,in<module>
from cherrypy._cpcompat import urljoin as _urljoin, urlencode as _urlencode
File"/usr/local/lib/python2.7/site-packages/cherrypy/_cpcompat.py", line 184,in<module>
from http.cookies importSimpleCookie,CookieError
ImportError:Nomodule named http.cookies
google之后才知道是缺少因为python中ssl支持,具体解决方法如下:
(1)yum install openssl-devel
(2)重新编译安装python
参见:
http://stackoverflow.com/questions/6643052/importerror-no-module-named-http-cookies-error-when-installing-cherrypy-3-2