For example, when I use pip install numpy
, I can use pip show numpy
to get the location of numpy package.
When I install numpy by conda, e.g. conda install numpy
, how can I get the location of this package?
For example, when I use pip install numpy
, I can use pip show numpy
to get the location of numpy package.
When I install numpy by conda, e.g. conda install numpy
, how can I get the location of this package?
You need to either
>>> import numpy
>>> print(numpy.__file__)
python3 -m whych numpy
will show the full path to the python executable that was used. You can also show the package version with
python3 -m whych numpy --module-version
(this is optional as it requires to actually import the module). The library
also works within Python (useful in jupyter notebooks for instance):
from whych import whych
whych("numpy")
As you can guess, I use the second solution. It is really convenient when you work on several computers and sometimes use pip, sometimes conda, and sometimes the package manager.