Setting a path

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nubean19
    New Member
    • Jun 2007
    • 4

    #1

    Setting a path

    Hi everyone,
    Im new to python and im trying to make sure my path is set correctly. I completed a program and save it but cant seem to make it run in cmd, it keep saying that it cannot find file or directory. Please help
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by nubean19
    Hi everyone,
    Im new to python and im trying to make sure my path is set correctly. I completed a program and save it but cant seem to make it run in cmd, it keep saying that it cannot find file or directory. Please help
    Give details of the command that you're typing. Have configured python correctly and added it to your path?

    Comment

    • bartonc
      Recognized Expert Expert
      • Sep 2006
      • 6478

      #3
      Originally posted by nubean19
      Hi everyone,
      Im new to python and im trying to make sure my path is set correctly. I completed a program and save it but cant seem to make it run in cmd, it keep saying that it cannot find file or directory. Please help
      In Windows, if you need to add the Python directory to your PATH environment variable, right click My Computer, pull down to Properties. On the Advanced tab click Environment variables. If there is a PATH variable there, select it and click edit, otherwise click new and name the new variable "PATH". INSERT something like "C:\python2 4;" (what ever is right for your system) at the beginning of the semicolon-separated list. Click OK and dismiss all the dialog boxes. At the command-line (cmd), you must either cd (change directory) to the folder where you .py file is located or type in the complete path. ie
      C:\Python Scripts>python myPythonScript. py.

      Hope that helps.

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by bartonc
        In Windows, if you need to add the Python directory to your PATH environment variable, right click My Computer, pull down to Properties. On the Advanced tab click Environment variables. If there is a PATH variable there, select it and click edit, otherwise click new and name the new variable "PATH". INSERT something like "C:\python2 4;" (what ever is right for your system) at the beginning of the semicolon-separated list. Click OK and dismiss all the dialog boxes. At the command-line (cmd), you must either cd (change directory) to the folder where you .py file is located or type in the complete path. ie
        C:\Python Scripts>python myPythonScript. py.

        Hope that helps.
        That said, there are much easier ways to run your script. One example: Python comes with a workable IDE called IDLE that lets you edit you .py files and run them from the menu.

        Comment

        Working...