我尝试在 python3 中使用它作为服务器运行 cgi 脚本:
from http.server import HTTPServer, CGIHTTPRequestHandler
port = 8080
httpd = HTTPServer(('', port), CGIHTTPRequestHandler)
print("Starting simple_httpd on port: " + str(httpd.server_port))
httpd.serve_forever()
但我收到以下错误:
Traceback (most recent call last):
File "/usr/lib/python3.2/http/server.py", line 1110, in run_cgi
os.execve(scriptfile, args, env)
OSError: [Errno 2] No such file or directory
localhost - - [21/Nov/2012 10:28:26] CGI script exit status 0x7f00
请帮忙。