0

I'm sorry if this question is simple but i'm new to Python and have searched around but not found my answer.

Here it is:

How do I run a .py file from the Python interpreter? I'd like to run this file: C:\Users\Myname\Desktop\Python\Python-Test.py

So far, I've:

  • Downloaded Active Python (http://www.activestate.com/activepython).
  • Set the PATH to open the interpreter from the Windows Command Line. The Python interpreter works fine, allowing me to print simple calculations.

Thanks for your time,

Dan.

3

1 Answer 1

1

If you want to know

How do I run a .py file from the Python interpreter?

this will work

import sys
sys.path.append("C:\\Users\\Myname\\Desktop\\Python")
import Python-Test

But your question says from the command line, which has been answered in the comments.

Sign up to request clarification or add additional context in comments.

1 Comment

Consider ticking a answer if it helped

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.