List installed files of a package?

自闭症网瘾萝莉.ら 提交于 2019-12-22 02:01:26

问题


I've done my homework: searched, tried and read conda documentation. However, I could not find the answer to this seeming common and simple task: List files that belong to an installed package. How do I do that?

My conda version: conda 4.3.30

I've looked at list, info, search, and package subcommands.

My use cases for this:

  1. When a package 'A' installed another package 'B' as its dependency. But B has a bug, or the installation somehow broken, I want to check which files B installed.

  2. An extended use: when commands of A calls some command b of B, but I don't know the exact name of B. A 'reverse' search based on b to find out B and lets me read more about it.


回答1:


Assuming you have activated the relevant anaconda environment, you can look at the file ${CONDA_PREFIX}/conda-meta/<package-name-and-version>-<hash>.json and look for the files element.

(this works with Miniconda on Linux)




回答2:


Found out that all packages that conda installed are stored under <root_environment>/pkgs. One can find out about root environment and other information by running conda info.

Then to list files that a package has:

tree <root_environment>/pkgs/<package_name>-<package_version>

or with find, one can also find which downloaded package has the command:

find <root_environment> -type f -iname 'somecommand'

<root_environment> here is a placeholder for something like ~/anaconda if one installed anaconda into ~/anaconda

This solution is rather *nix-specific but it is good enough to me.



来源:https://stackoverflow.com/questions/47138241/list-installed-files-of-a-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!