简体   繁体   中英

How to start python simpleHTTPServer on 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.

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

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

Does anyone know how to do this on Windows 10?

Ok, so different commands is apparently needed.

This works:

C:\\pathToIndexfile\\py -m http.server

As pointed out in a comment, the change to "http.server" is not because of windows, but because I changed from python 2 to python 3.

如果您已经安装了python 3 ,只需运行:

python -m http.server 

On Windows, neither python nor python3 worked for me; the program just hangs there, doing nothing.

However, I got it to work via ipython :

ipython -m http.server 8000

You need to install IPython beforehand, though:

pip install ipython

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM