我在Mac上安装了Python和Anaconda两个版本,分别是3.5和3.7。有没有办法知道我在3.5中安装了哪些软件包而不是3.7中的软件包,例如可以使用pip安装的软件包(纸浆,wordcloud等)。
到目前为止,我一直在尝试使用命令行:
DB::connection('database_name')->query
这显示了目录之间的差异,但显示了许多重复包和核心模块的信息。如何找到两个Anaconda版本之间的软件包差异?
答案 0 :(得分:4)
您可以使用conda list
列出在特定环境下安装的所有软件包。另外,您可以将列表导出到带有标志--export
的文件。
例如,如果您的环境分别命名为python3
和pytorch_p36
,则可以执行以下操作:
conda list -n python3 --export > python3-packages.txt
conda list -n pytorch_p36 --export > pytorch_p36-packages.txt
diff python3-packages.txt pytorch_p36-packages.txt
该命令还接受标志--json
,该标志将以json格式导出数据,适用于自动处理。
答案 1 :(得分:1)
感谢dataista为您的Linux解决方案。对于Windows差异无法正常工作,但是在 Windows 中,可以使用 FC :
conda list -n python3 --export > python3-packages.txt
conda list -n pytorch_p36 --export > pytorch_p36-packages.txt
FC python3-packages.txt pytorch_p36-packages.txt
答案 2 :(得分:0)
现在,最近的一项开发提供了将conda环境与需求文件进行比较的功能。到目前为止,我发现的唯一提及内容是在2020年7月16日合并的pull request中。我可以验证compare
命令在conda版本4.8.4中有效。应该注意的是,输出中仅列出了差异。
用法:
(ProcMCD43A1) C:\Users\justincase>conda compare environment.yml --json
[
"argon2-cffi found but mismatch. Specification pkg: argon2-cffi==20.1.0=py37he774522_1, Running pkg: argon2-cffi==20.1.0=py37h4ab8f01_1",
"attrs found but mismatch. Specification pkg: attrs==19.3.0=py_0, Running pkg: attrs==20.2.0=pyh9f0ad1d_0",
"backcall found but mismatch. Specification pkg: backcall==0.2.0=py_0, Running pkg: backcall==0.2.0=pyh9f0ad1d_0",
"bleach found but mismatch. Specification pkg: bleach==3.1.5=py_0, Running pkg: bleach==3.2.0=pyh9f0ad1d_0",
"brotlipy found but mismatch. Specification pkg: brotlipy==0.7.0=py37he774522_1000, Running pkg: brotlipy==0.7.0=py37h4ab8f01_1000",
"bzip2 found but mismatch. Specification pkg: bzip2==1.0.8=he774522_0, Running pkg: bzip2==1.0.8=he774522_3",
"cffi found but mismatch. Specification pkg: cffi==1.14.0=py37h7a1dbc1_0, Running pkg: cffi==1.14.3=py37h26f1ce3_0",
"cfitsio found but mismatch. Specification pkg: cfitsio==3.470=he774522_5, Running pkg: cfitsio==3.470=hbbe6aef_6",
"cftime found but mismatch. Specification pkg: cftime==1.2.1=py37h2a96729_0, Running pkg: cftime==1.2.1=py37h44b1f71_0",
"chardet found but mismatch. Specification pkg: chardet==3.0.4=py37_1003, Running pkg: chardet==3.0.4=py37hc8dfbb8_1006",
"click not found",
"click-plugins not found",
"cligj not found",
"cryptography found but mismatch. Specification pkg: cryptography==2.9.2=py37h7a1dbc1_0, Running pkg: cryptography==3.1=py37h26f1ce3_0",
"curl found but mismatch. Specification pkg: curl==7.67.0=h2a8f88b_0, Running pkg: curl==7.71.1=h4b64cdc_5",
"cycler found but mismatch. Specification pkg: cycler==0.10.0=py37_0, Running pkg: cycler==0.10.0=py_2",
"descartes not found",
"entrypoints found but mismatch. Specification pkg: entrypoints==0.3=py37_0, Running pkg: entrypoints==0.3=py37hc8dfbb8_1001",
"fiona not found",
"freexl found but mismatch. Specification pkg: freexl==1.0.5=hfa6e2cd_0, Running pkg: freexl==1.0.5=hd288d7e_1002",
"gdal found but mismatch. Specification pkg: gdal==3.0.2=py37hdf43c64_0, Running pkg: gdal==3.1.2=py37h6ddc196_1",
"geopandas not found",
"geos found but mismatch. Specification pkg: geos==3.8.0=h33f27b4_0, Running pkg: geos==3.8.1=he025d50_0",
"geotiff found but mismatch. Specification pkg: geotiff==1.5.1=h5770a2b_1, Running pkg: geotiff==1.6.0=h09e6dc1_1",
"h5py not found",
"hdf4 found but mismatch. Specification pkg: hdf4==4.2.13=h712560f_2, Running pkg: hdf4==4.2.13=hf8e6fe8_1003",
"hdf5 found but mismatch. Specification pkg: hdf5==1.10.4=h7ebc959_0, Running pkg: hdf5==1.10.6=nompi_he0bbb20_101",
...
]