找不到Python cgi服务器模块

时间:2016-04-29 14:21:22

标签: python python-3.x cgi

当我在cmd中运行var obj = { a: true, b: false }; %HasFastProperties(obj); // true (Fast mode) // add lots of properties for (var i = 0; i < 100; i++) { obj["prop" + i] = i; } %HasFastProperties(obj); // false (Dictionary mode) python -m SimpleHTTPServer 8000时,出现此错误:

  

没有名为SimpleHTTPServer的模块

  

没有名为CGIHTTPServer的模块

有谁知道为什么会这样或者测试python cgi-scripts的其他方法?

2 个答案:

答案 0 :(得分:2)

这不是你从命令行启动它们的方式。

请参阅the docs:基本HTTP服务器以

启动
python -m http.server 8000

和CGI服务器

python -m http.server --cgi 8000

答案 1 :(得分:0)

Fom this回答:

python -m http.server [<portNo>]