我已经在virtualenv中使用pip安装了cherrypy并运行了第一个教程:
import cherrypy
class HelloWorld(object):
@cherrypy.expose
def index(self):
return "Hello world!"
if __name__ == '__main__':
cherrypy.quickstart(HelloWorld())
它抛出错误:
Traceback (most recent call last):
File "C:/wc/playground/scripts/cherrypy.py", line 1, in <module>
import cherrypy
File "C:\wc\playground\scripts\cherrypy.py", line 4, in <module>
class HelloWorld(object):
File "C:\wc\playground\scripts\cherrypy.py", line 5, in HelloWorld
@cherrypy.expose
AttributeError: module 'cherrypy' has no attribute 'expose'
任何人都知道为什么?