当我运行python3 -m http.server --cgi 8000时 它说:
Traceback (most recent call last):
File "/usr/lib/python3.2/runpy.py", line 160, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python3.2/runpy.py", line 73, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.2/http/server.py", line 1187, in <module>
test(HandlerClass=SimpleHTTPRequestHandler)
File "/usr/lib/python3.2/http/server.py", line 1169, in test
port = int(sys.argv[1])
ValueError: invalid literal for int() with base 10: '--cgi'
答案 0 :(得分:1)
看起来--cgi标志只在python 3.3中添加。你正在使用python 3.2,它希望唯一的参数是一个端口号。
修复似乎是升级到python 3.3或不使用--cgi。