我从我当前环境丢失的包的 yml 文件中获取了这些。我如何在我当前的环境中安装它们?
channels:
- defaults
dependencies:
- appdirs=1.4.3=py36h28b3542_0
- asn1crypto=0.24.0=py36_0
- attrs=18.2.0=py36h28b3542_0
- blas=1.0=mkl
- cffi=1.11.5=py36h6174b99_1
- constantly=15.1.0=py36h28b3542_0
- cryptography=2.3.1=py36hdbc3d79_0
- freetype=2.9.1=hb4e5f40_0
- html5lib=1.0.1=py36_0
- idna=2.7=py36_0
- incremental=17.5.0=py36_0
- intel-openmp=2019.0=118
- libgfortran=3.0.1=h93005f0_2
- libxml2=2.9.4=0
- libxslt=1.1.29=hc208041_6
- lxml=4.1.1=py36h6c891f4_0
- mkl=2019.0=118
- mkl_fft=1.0.6=py36hb8a8100_0
- mkl_random=1.0.1=py36h5d10147_1
- numpy=1.15.3=py36h6a91979_0
- numpy-base=1.15.3=py36h8a80b8c_0
- pyasn1=0.4.4=py36h28b3542_0
- pyasn1-modules=0.2.2=py36_0
- pycparser=2.19=py36_0
- pyopenssl=18.0.0=py36_0
- service_identity=17.0.0=py36h28b3542_0
- twisted=17.5.0=py36_0
- zope=1.0=py36_1
- zope.interface=4.5.0=py36h1de35cc_0
- pip:
- absl-py==0.2.2
- ete3==3.1.1
- grpcio==1.12.1
最佳答案
Conda 环境更新
如果您有 YAML 文件,那么将其应用于给定环境的最有效方法是使用 conda env update
:
conda env update --file environment.yml
⚠️ Warning: The
conda env
commands don't prompt you to review and approve the transactions - it simply executes the changes. Be sure to carefully review the YAML file to ensure all of the changes are desired.
conda 安装
Conda 接受的 conda install --file
格式与 conda list --export
的输出匹配。它不是 YAML,而是一个简单的文本文件,每行一个包,类似于 pip freeze
生成的文件,除了单个等号('=' 而不是 ==
)。
conda list --export
appdirs=1.4.3=py36h28b3542_0
asn1crypto=0.24.0=py36_0
...
zope=1.0=py36_1
zope.interface=4.5.0=py36h1de35cc_0
请注意,构建不是必需的,例如,以下内容也可以工作,并且实际上可能在跨体系结构中更具可移植性
appdirs=1.4.3
asn1crypto=0.24.0
...
zope=1.0
zope.interface=4.5.0
不幸的是,conda install
不支持 PyPI 包;您必须在激活的环境中通过 pip install
单独安装它们。
关于python - 如何在不创建新环境的情况下从一个文件在 conda 中安装多个包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52998670/