You need to install the Python web, you need to install the PIP, and the installation method resolves itself.
To install the Python Web:
sudo pip install web.py
The problem with the NO socket could be created was encountered while learning the Python Web:
The code to write is as follows:
#!/usr/bin/env python2
#-*-coding:utf-8-*-
Import web
urls = (
'/', ' Index '
)
class index:< C6/>def Get (self): return
"Hello, world!"
if __name__ = = "__main__":
web.application (URLs, Globals ()). Run ()
After careful examination of no code errors, the runtime encountered the following error:
http://0.0.0.0:8080/
Traceback (most recent):
File "game.py", line, in <module>
App.run ( The
File "/library/python/2.7/site-packages/web/application.py", line 313, and in the Run return
Wsgi.runwsgi ( Self.wsgifunc (*middleware))
File "/library/python/2.7/site-packages/web/wsgi.py", line, in Runwsgi
Return Httpserver.runsimple (func, server_addr)
File "/library/python/2.7/site-packages/web/httpserver.py", Line 157, in Runsimple
Server.start ()
File "/library/python/2.7/site-packages/web/wsgiserver/__init__.py", Line 1753, in start
raise Socket.error (msg)
Socket.error:No socket could is created
Depressed ah, tangled up for a long time, thinking that the code to write a problem, the last feeling when the port out of the problem, may be occupied by the port, changed a port on the good, Haha,
Python game.py 8081 #指定在8081端口运行