为 Python3.3 安装 Cherrypy

为 Python3.3 安装 Cherrypy

请帮助我安装 Cherrypy3.2 以在 Python3.3 上工作/运行。我使用的是 Ubuntu 13.04,并且已经安装了 Python3.3。我已下载 Cherrypy3.2.2 并尝试安装它,没有发现任何错误消息,但是当我尝试导入 cherrypy 时,我收到一条错误消息。

这是我得到的。

aspire@aspire:~$ python3.3 -c "import cherrypy"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.3/dist-packages/CherryPy-3.2.2-py3.3.egg/cherrypy/__init__.py", line 82, in <module>
    from cherrypy import process
  File "/usr/local/lib/python3.3/dist-packages/CherryPy-3.2.2-py3.3.egg/cherrypy/process/__init__.py", line 14, in <module>
    from cherrypy.process import plugins, servers
  File "/usr/local/lib/python3.3/dist-packages/CherryPy-3.2.2-py3.3.egg/cherrypy/process/plugins.py", line 424, in <module>
    class PerpetualTimer(threading._Timer):
AttributeError: 'module' object has no attribute '_Timer'
aspire@aspire:~$

答案1

据报道有错误随着python从3.2升级到3.3,_Timer模块被重命名为Timer。

在文本编辑器中打开“/usr/local/lib/python3.3/dist-packages/CherryPy-3.2.2-py3.3.egg/cherrypy/process/plugins.py”,并将第 424 行的 _Timer 替换为 Timer。

相关内容