如何在Windows 10上启动python simpleHTTPServer [英] How to start python simpleHTTPServer on Windows 10

查看:451
本文介绍了如何在Windows 10上启动python simpleHTTPServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近购买了一台Windows 10计算机,现在我想在本地运行服务器以测试正在开发的网页.

I recently bought a Windows 10 machine and now I want to run a server locally for testing a webpage I am developing.

在Windows 7上,通过python和命令提示符启动HTTP Server总是非常简单. FX编写下面的代码将启动HTTP服务器,我可以通过localhost观看网站.

On Windows 7 it was always very simple to start a HTTP Server via python and the command prompt. Fx writing the below code would fire up a HTTP server and I could watch the website through localhost.

C:\ pathToIndexfile \ python -m SimpleHTTPServer

C:\pathToIndexfile\python -m SimpleHTTPServer

但是,这似乎在Windows 10上不起作用...

This does however not seems to work on Windows 10...

有人知道如何在Windows 10上执行此操作吗?

Does anyone know how to do this on Windows 10?

推荐答案

好,因此显然需要其他命令.

Ok, so different commands is apparently needed.

这有效:

C:\ pathToIndexfile \ py -m http.server

C:\pathToIndexfile\py -m http.server

正如评论中指出的那样,对"http.server"的更改不是因为Windows,而是因为我从python 2更改为python 3.

这篇关于如何在Windows 10上启动python simpleHTTPServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆