-1

I have been having issues installing pandas for Python. I use python in both IDLE and terminal and my computer is a Mac if this is relevant. I have tried the following commands:

sudo apt-get install python-pip
pip install pandas
pip install pip
$ pip install pandas
import pandas as pd

and I always receive error messages. What do I need to do to get this to work?

Note: I am very new to python.

Error messages in IDLE:

SyntaxError: invalid syntax

Error messages in terminal:

[me] is not in the sudoers file. This incident will be reported.
zsh: command not found: pip
zsh: command not found: pip
zsh: command not found: $
zsh: command not found: import

buddemat
  • 4,552
  • 14
  • 29
  • 49
  • 1
    First off, warm welcome to Stack Overflow. But secondly, it would be pretty useful if you would show exactly what error messages you're getting; it'll be difficult to diagnose the problem without them – FatSoviet Dec 05 '20 at 02:13
  • Thanks. I just edited my question to include the error messages. – W. W. Atkinson Dec 05 '20 at 02:19
  • These were all very helpful. Thank you. – W. W. Atkinson Dec 05 '20 at 03:49
  • UPDATE: I have downloaded pandas with the pip3, but am still receiving the "zsh: command not found: import" error message. – W. W. Atkinson Dec 05 '20 at 03:58
  • 1
    Are you trying to use ```import``` directly on the command line? The ```import``` command needs to go in the .py file that you're trying to run, not on the command line; try putting ```import pandas as pd``` at the top of your .py file with whatever your text editor of choice is (nano, vim, or in the .py file creator in IDLE) – FatSoviet Dec 05 '20 at 04:21
  • I'll try that. Thanks. – W. W. Atkinson Dec 07 '20 at 16:02

2 Answers2

0

There are a couple of things in the wrong here.

[me] is not in the sudoers file. This incident will be reported

Are you logged in as a admin user on your Mac? If not, you'll need to do so to run commands with the prefix "sudo"

zsh: command not found: pip zsh: command not found: pip zsh: command not found: $ zsh: command not found: import

It seems like python and pip are not set up properly on your mac. Please follow this guide to set up Python on your system: https://opensource.com/article/19/5/python-3-default-mac

SkV
  • 60
  • 1
  • 1
  • 11
0

zsh command cannot found pip

The linked thread seems to discuss a pretty similar problem to your own. To give a summary, it's entirely possible that you have python2 and python3 installed. Try running the command:

pip3 -V

If you see a version come up, then you can use pip3 instead of pip, and use the command pip3 install pandas. There are some other solutions in the linked thread as well.

Dharman
  • 30,962
  • 25
  • 85
  • 135
FatSoviet
  • 57
  • 6