I have written a simple python program using IDLE to run it from command line. I don't have permission to save .py file in python directory (C:\program files\python33) so I saved it to C:\Pyscripts.
Also python was already been added to the PATH and I can run a simple print ("Hello")
in command line. I have saved this line into a py file and Now I want to run it from command prompt but I have faced different errors! I have searched and tested different ways but they didn't work!
any suggestion?
Thanks.
cd C:\Pyscripts
python filename.py
For basics like print 'hello'
, you don't need any library import statements but for slightly more complex things you will.
Which python do you have installed?
You don't want to save files in c:\program files under windows. That isn't a good practice. Setting up a dev directory like you did or under your user directory is a much better option.
Have you added python to the path setting? If you start a command prompt (cmd.exe, not IDLE and type python
, what do you get? If you haven't set the python path, see http://docs.python.org/2/using/windows.html or http://www.katsbits.com/tutorials/blender/setting-up-windows-python-path-system-variable.php. Just update the settings to the version of python you are using e.g c:\python27.
Get a text editor instead of using IDLE. textpad, textedit, vim, emacs ,context, geanie, sublime, and many many more. Or get an IDE. Aptana's studio 3 is easy to use and free (eclipse with plugins already installed) or the free community version of pycharm.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments