How to set python enviroment variable on windows
I've downloaded python installer from http://www.python.org/ftp/python/3.1.2/ , this python-3.1.2.msi
file, I need to execute some python files? How do I do that? For example in php I'd do php filename.php from console, I do however ha开发者_StackOverflow中文版ve python command line but I don't know how to execute those files.
So if I could set ENV variable to directly execute my file(s) if that is possible that would be great.
There is an option in the installer called "Register Extensions" to associate Python files with the interpreter, so double-clicking them or entering filename.py
in the console should work.
Apart from that you might want to add C:\Python31
to your PATH
variable (right-click on My Computer, choose Settings, choose the Advanced Tab - there you can access the system variables. Better do this as an admin.
If you type python
in the Windows command line, what happens? Is the Python interpreter in your PATH
yet?
If not, add the Python installation directory there (here's a good guide). Then just do python script.py
just like with PHP.
you can just execute
python yourfile.py
Or if the python command don't work you have to give the absolute path to you python installation or add it to windows path
精彩评论