1

Is there a way to programmatically find the location of a python package once it is imported?

For example:

import os

import pandas

os.get_package_directory(panda)
>>> C:\Users\username\miniconda3\pkgs\pandas-1.0.5-py37h47e9c7a_0

Blithering
  • 560
  • 5
  • 14
  • 1
    Check this previous question: https://stackoverflow.com/questions/247770/how-to-retrieve-a-modules-path – Daruri Jul 13 '20 at 08:44

1 Answers1

3

It's been a while since I've done this, but try this:

import pandas
print(pandas.__file__)
fesieg
  • 467
  • 1
  • 4
  • 14