# wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 # tar xf Python-2.7.3.tar.bz2 # cd Python-2.7.3 # ./configure --prefix=/usr/local # make && make altinstall
if __name__ == "__main__": application.listen(8888) tornado.ioloop.IOLoop.instance().start()
4、运行文件 $ python tornado_example.py
1) 出现下面的错误 import zlib ImportError: No module named zlib
解决方法:再次编译python。 进入python源程序目录执行 : $./configure --with-zlib $make && make install
2) 出现下面的错误 Traceback (most recent call last): File "./tornado_example.py", line 5, in <module> import tornado.web File "/usr/local/python2.7.3/lib/python2.7/site-packages/tornado/web.py", line 80, in <module> from tornado import iostream File "/usr/local/python2.7.3/lib/python2.7/site-packages/tornado/iostream.py", line 40, in <module> from tornado.netutil import ssl_wrap_socket, ssl_match_hostname, SSLCertificateError File "/usr/local/python2.7.3/lib/python2.7/site-packages/tornado/netutil.py", line 44, in <module> import backports.ssl_match_hostname ImportError: No module named backports.ssl_match_hostname