第一次尝试安装 Tornado(在 EC2 Linux 实例上)。我做了
pip install tornado
然后尝试运行 hello world 示例:http ://www.tornadoweb.org/en/stable/#hello-world
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(80)
tornado.ioloop.IOLoop.instance().start()
然后我尝试:
python hello.py
但得到:
回溯(最后一次调用):文件“testing/tornado.py”,第 1 行,
导入 tornado.ioloop 文件“/opt/pdf_engine/testing/tornado.py”,第 1 行,
导入 tornado.ioloop ImportError:否名为 ioloop 的模块