Skip to content Skip to sidebar Skip to footer

How To Use Simplehttpserver?

I'm trying to start a simple http server with the most recent version of Python 2.7. I'm following a tutorial and it instructs me to do the following: Open the Terminal then naviga

Solution 1:

Firstly, if you're just starting to learn Python, I (and the members of the Stack Overflow Python community) stronglyrecommend using Python 3. Py2 is the past, Py3 is the present and future of the language. Support for Py2 ends in 2020, while Py3 will be supported indefinitely. You will learn some bad habits with Py2 that will make learning Py3 (which you'll have to do eventually) that much harder. Learn Py3 now, and when you're proficient with it you can then go back and see what the differences are with Py2. Also, stay away from the Learn Python the Hard Way tutorial. It's bad.

When you go to the download page I linked above, choose the installer for your version of Windows - if you're using 64-bit Windows, choose the 64-bit installer. When you run it, change the default installation directory to C:\Python35, and select the option to add the installation directory to your PATH. Once installation is complete, you can then uninstall Python 2 if you wish.

You can now open up the command line and run

python -m http.server

and it should work as expected.

Solution 2:

The dollar sign is not part of the command:

python -m SimpleHTTPServer

I guess it was simply used as a representation for the command line prompt in the tutorial you have been following

Post a Comment for "How To Use Simplehttpserver?"