You can find the location of a package using the command: pip show <package name>
The following example shows the location of "xgboost" on my Ubuntu machine.
pip show xgboost
Name: xgboost
Version: 1.7.1
Summary: XGBoost Python Package
Home-page: https ://github.com/dmlc/xgboost
Author:
Author-email:
License: Apache-2.0
Location: /home/****/envpycoding/lib/python3.10/site-packages
Requires: numpy, scipy
Required-by: