-1

I am required to install pandas using the .py file using the linux command line, before importing pandas once it is installed. If anyone knows how to also do this on macOS that would be appreciated as well.

Thanks

spookums
  • 3
  • 4
  • 1
    Possible duplicate of [Install Pandas on Mac with pip](https://stackoverflow.com/questions/42616376/install-pandas-on-mac-with-pip) – Nate Schultz May 30 '19 at 17:23
  • 1
    Possible duplicate of [Installing Python packages from local file system folder to virtualenv with pip](https://stackoverflow.com/questions/15031694/installing-python-packages-from-local-file-system-folder-to-virtualenv-with-pip) – Casper Gerritsen May 30 '19 at 18:08

1 Answers1

1

I believe you want to do something like:

import os
cmd = 'sudo pip install pandas'
os.system(cmd)

based on: https://cmdlinetips.com/2014/03/how-to-run-a-shell-command-from-python-and-get-the-output/

Jose Cabrera Zuniga
  • 2,348
  • 3
  • 31
  • 56