1

I just installed python 2.7 on a windows machine to start SimpleHTTPServer in order to test my d3.js code.

Normally on my linux laptop I would start a terminal window in the folder where my files are (index.html, data.json, etc). However, if I do the same on windows it doesn't work.

The only way to make this works is when I run python -m SimpleHTTPServer 8000in the python installation folder (in my case C:\Python27).

I read here that I need to set the python environment variable. The screen shows what I have done. As you can see I set the variable both locally (for the current user) and system-wide. However, when I try to run a pythoncommand out of the installation folder nothing changes.

enter image description here

Fraser
  • 15,275
  • 8
  • 53
  • 104
Fede9390
  • 349
  • 2
  • 18

1 Answers1

0

The python variable is incorrect - rather you should add the python executable path to the PATH environment variable e.g.

PATH=C:\Python27\;C:\Python27\Scripts;

You should then be able to call python from anywhere.

Indeed any path you include in the PATH will then allow you to call executables in that path without specifying the full path or extension.

i.e.

C:\Python27\python.exe becomes python

C:\WINDOWS\system32\cmd.exe becomes cmd

For more detail see: https://en.wikipedia.org/wiki/PATH_(variable) or my answer to this question: Error in Process.Start() -- The system cannot find the file specified

Community
  • 1
  • 1
Fraser
  • 15,275
  • 8
  • 53
  • 104