spookums
spookums

Reputation: 3

Need to install pandas library directly from a python file on MacOS

I am required to use a fresh Mac OS with no libraries unless I can find a way to download pandas using a .py file on the fresh VM. How would I do this on MacOS?

Upvotes: 0

Views: 294

Answers (2)

cwalvoort
cwalvoort

Reputation: 1967

You will need to have the entire .tar.gz download in order to install the package, not just a single .py file. As described here as well, once you have the .tar.gz, you can unpack it, navigate to the directory, and execute the setup.py file:

python setup.py install

You can get the latest version of pandas here.

Update after comment/update

Check out using subprocess to issue commands.

import subprocess
import sys

version = 0.24.2
package = 'pandas'

subprocess.call(['sudo', sys.executable, '-m', 'pip', 'install', '{}=={}'.format(package, version)])

Upvotes: 1

Vishal
Vishal

Reputation: 96

If you have already installed pip with your python setup, you can download the wheel file of pandas library and install it using pip.

More about it here.

Upvotes: 0

Related Questions