在 Windows 上设置 Python simpleHTTPserver

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17351016/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 07:58:45  来源:igfitidea点击:

Set up Python simpleHTTPserver on Windows

pythonwindowspython-3.xsimplehttpserver

提问by codeofnode

I want to set up Python SimpleHTTPServeron Windows XP. I have Python installed on my computer. I am executing the following command:

我想SimpleHTTPServer在 Windows XP 上设置 Python 。我的电脑上安装了 Python。我正在执行以下命令:

python -m SimpleHTTPServer 8888

But I am getting the error:

但我收到错误:

C:\Python33\python.exe: No module named SimpleHTTPServer

Is SimpleHTTPServerfor Python available on Windows? If yes, what do I do to set up the server?

SimpleHTTPServer的Python在Windows上使用?如果是,我该如何设置服务器?

采纳答案by codeofnode

From Stack Overflow question What is the Python 3 equivalent of "python -m SimpleHTTPServer":

从堆栈溢出问题什么是“python -m SimpleHTTPServer”的 Python 3 等价物

The following works for me:

以下对我有用:

python -m http.server [<portNo>]

Because I am using Python 3the module SimpleHTTPServerhas been replaced by http.server, at least in Windows.

因为我使用的是Python 3,该模块SimpleHTTPServer已被替换为http.server,至少在 Windows 中是这样。