1.通过pip进行安装
命令:pip install tornado
截图:
2.验证安装是否成功
示例代码:
#!/usr/bin/python
import tornado.ioloop
import tornado.web
class Demo(tornado.web.RequestHandler):
def get(self):
self.write("Hello,suyanzhu")
def run():
return tornado.web.Application([
(r"/", Demo),
])
if __name__ == "__main__":
app = run()
app.listen(9999)
tornado.ioloop.IOLoop.current().start()
代码截图:
运行截图:
python test.py