0

My file name is 'corr.py' located in the Downloads folder and I'm running python 2.7 in terminal in the correct working directory. When I run the command 'python corr.py' I get the error message below. What should I do?

>>> os.getcwd()
'/Users/Daniel/Downloads'
>>> python corr.py
  File "<stdin>", line 1
    python corr.py
              ^
SyntaxError: invalid syntax
>>> python3 corr.py
  File "<stdin>", line 1
    python3 corr.py
               ^
SyntaxError: invalid syntax
0

1 Answer 1

5

You're in a Python interpreter already. First type exit() to get back to the terminal. (Or just open a new terminal tab/window.) Then use python corr.py.

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

1 Comment

Thanks! That worked. The first line of code in my script is import pandas as pd. When I run the script, I get the message, "ImportError: No module named pandas." How do I fix that?

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.