when I try to run “import os”, my Mac terminal always respond “-bash: import: command not found”

5 pts.
Tags:
Python
when I try to run "import os", my Mac terminal always respond "-bash: import: command not found"
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Subhendu Sen

    Have you proper right to do this job? Have you Admin rights? Is this your office/ for personal use? What Mac flavor is there?

    Please provide more information.

    140,850 pointsBadges:
    report
  • Tom Curtin
    Answer courtesy of ToddN2000:

    "This error means Python is either not installed or your installation damaged. Here is how you might solve this problem.

    Check for python path
    Type any one of the following commands to see if python binary exists on a Linux or Unix-like system:

    type -a python

    OR
    ls -l /usr/bin/python
    ls -l /usr/bin/python*

    OR
    which python

    It seems that Python is missing for an unknown reason or was not installed by your cloud provider to save the disk space. So install it as per your Linux distro or Unix variant:"

    965 pointsBadges:
    report
  • Subhendu Sen

    Have you tried to use the "man" command to find out more information about "import". Are you trying to write a python/ C program?

    Keep in mind, Import is a command in Python. It is not a system level command that bash can find.

    140,850 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: