How does python know where your import package is/where is the site-package/where are the module files in anaconda

reference:

  • https://stackoverflow.com/questions/31003994/where-is-site-packages-located-in-a-conda-environment

The site-package in the anaconda virtual environment is in the following directory, /opt/conda/envs/env_cp37_STAGATE_TF/lib/python3.7/site-packages/.

Based on the question of where is the physical location of your guide package. First enter your python environment, then import the package, and query __file__the properties of the package. The parent directory where the file is located is also site-packagethe location.

You can import the module and check the module.__file__ string. It contains the path to the associated source file.

Alternatively, you can read the File tag in the the module documentation, which can be accessed using help(module), or module? in IPython.

For example,

Please add a picture description

So we know that our virtual environment is site-pakcagesin/opt/conda/envs/env_cp37_STAGATE_TF/lib/python3.7/site-packages/

Guess you like

Origin blog.csdn.net/qq_43369406/article/details/131807049